private void OnEnable() { //slow the ghost down m_movementController.SetSpeed(m_movementController.GetSpeed() * speedMultiplier); //reverse direction m_movementController.ChangeDirection(-m_movementController.GetDirection()); gameObject.GetComponent <Animator>().SetTrigger("flee"); isEnabled = true; }
private void Awake() { // mySnake = (GameObject) Instantiate(mySnake,transform.position,Quaternion.identity); // mySnake.name = "BlueHead"; txtScore = GameObject.FindGameObjectWithTag("Score").GetComponent <Text>(); NodeMovement.SetSpeed(5f); SnakeHeadController.SetSpeed(5f); score = 0; health = 3; }
IEnumerator Slowly(float _delay) { NodeMovement.SetSpeed(2f); SnakeHeadController.SetSpeed(2f); yield return(new WaitForSeconds(_delay)); NodeMovement.SetSpeed(OldSpeed); SnakeHeadController.SetSpeed(OldSpeed); Destroy(gameObject); }