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; }
void OnTriggerEnter(Collider other) { if (other.CompareTag("SnakeHead")) { _audioEat.Play(); OldSpeed = NodeMovement.GetSpeed(); transform.position = Vector3.down * 2; GameManager.SetAddScore(-50); StartCoroutine(Slowly(Random.Range(0.5f, 4f))); } }