void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Ghost") { GhostStateManager ghostStateManager = collision.gameObject.GetComponent <GhostStateManager>(); ReactToGhost(ghostStateManager); } }
// Use this for initialization void Start() { ghostController = GetComponent <GhostController>(); ghostStateManager = ghostController.GetGhostStateManager(); bouncingUp = true; hasArrivedToCenter = false; }
private void ReactToGhost(GhostStateManager ghostStateManager) { if (ghostStateManager.GetGhostState() == GhostState.FRIGHTENED) { ghostStateManager.Die(); // ghostStateManager.gameObject.GetComponent<GhostController>().Die()... } else { gameController.Die(); } }
// Use this for initialization void Start() { motor = GetComponent <Motor>(); ghostPathFinder = GetComponent <GhostPathFinder>(); ghostScriptedMovement = GetComponent <GhostScriptedMovement>(); ghostStateManager = GetComponent <GhostStateManager>(); animator = GetComponent <Animator>(); direction = Vector2.zero; move = true; // Choose Pathfinder now, otherwise both will modify // the direction at the beginning. ChoosePathFinder(); }
private void UpdateGhostCounter() { if (currentGhost != null) { GhostStateManager ghostStateManager = currentGhost.GetGhostStateManager(); if (ghostStateManager.GetGhostState() == GhostState.HOME) { ghostStateManager.IncrementDotCounter(); } else { UpdateCurrentGhost(); } } }
// Use this for initialization void Start() { ghost = gameObject.rigidbody2D; stateManager = GetComponent <GhostStateManager>(); }
void Start() { pacmanController = pacman.GetComponent <PacmanController> (); pathFinder = GetComponent <GhostPathFinder>(); ghostStateManager = GetComponent <GhostStateManager>(); }
// Use this for initialization void Start() { ghostStateManager = GetComponent <GhostStateManager>(); }