本文整理匯總了C#中Ball.Respawn方法的典型用法代碼示例。如果您正苦於以下問題:C# Ball.Respawn方法的具體用法?C# Ball.Respawn怎麽用?C# Ball.Respawn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Ball
的用法示例。
在下文中一共展示了Ball.Respawn方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: initLevel
/*
INITLEVEL: restarts the current level, resets ball status and position; respawns any destructibles.
*/
public void initLevel()
{
print("Level initialized");
GameMenuLose = GameObject.Find("LoseMenu");
GameMenuWin = GameObject.Find("WinMenu");
RespawnableObjects = GameObject.FindGameObjectsWithTag("BuildOnEnd");
RespawnableObjectsWithParticles = GameObject.FindGameObjectsWithTag("BuildOnEndParticleChild");
// Initlevel may have an external call
objectBall = GameObject.Find("RollerBall");
theBall = (Ball)objectBall.GetComponent(typeof(Ball));
//Default parameters
Resume();
GameMenuWin.SetActive(false);
GameMenuLose.SetActive(false);
theBall.Respawn();
CountText.text = (lvl_timer).ToString();
theBall.setStatus(0);
CurrentTime = 0;
for (int i = 0; i< RespawnableObjects.Length; i++)
{
print(RespawnableObjects[i].name);
RespawnableObjects[i].GetComponent<Collider>().enabled = true;
RespawnableObjects[i].GetComponent<Renderer>().enabled = true;
}
/*
VERY IMPORTANT THE STRUCTURE OF A PARTICLE POWERUP MUST BE OF THE STRUCTURE
POWERUP_
.CHILD PARTICLE 1 ->SPACE(0)
.CHILD PARTICLE 2 ->SPACE(1)
*/
for (int i = 0; i <RespawnableObjectsWithParticles.Length; i++)
{
print("Respanwed: "+RespawnableObjectsWithParticles[i].name);
RespawnableObjectsWithParticles[i].GetComponent<Collider>().enabled = true;
RespawnableObjectsWithParticles[i].transform.GetChild(0).GetComponent<ParticleSystem>().enableEmission = true;
RespawnableObjectsWithParticles[i].transform.GetChild(1).GetComponent<ParticleSystem>().enableEmission = true;
}
}
示例2: Start
// Use this for initialization
void Start()
{
audioS = gameObject.AddComponent<AudioSource>();
objectBall = GameObject.Find("RollerBall");
theBall = (Ball)objectBall.GetComponent(typeof(Ball));
theBall.Respawn();
print("BALL AT START during the beggining");
initLevel();
}