public void PacmanCollide(Collider2D _pacman) { NodeMovement pacmanMovement = _pacman.GetComponent <NodeMovement>(); _pacman.transform.position = m_target.transform.position; pacmanMovement.m_previous = m_target; pacmanMovement.m_next = m_target.GetNextAt(pacmanMovement.GetDirection()); }
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; }