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();
        }
    }
Example #4
0
    // 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();
    }
Example #5
0
 private void UpdateGhostCounter()
 {
     if (currentGhost != null)
     {
         GhostStateManager ghostStateManager = currentGhost.GetGhostStateManager();
         if (ghostStateManager.GetGhostState() == GhostState.HOME)
         {
             ghostStateManager.IncrementDotCounter();
         }
         else
         {
             UpdateCurrentGhost();
         }
     }
 }
Example #6
0
 // Use this for initialization
 void Start()
 {
     ghost        = gameObject.rigidbody2D;
     stateManager = GetComponent <GhostStateManager>();
 }
Example #7
0
 void Start()
 {
     pacmanController  = pacman.GetComponent <PacmanController> ();
     pathFinder        = GetComponent <GhostPathFinder>();
     ghostStateManager = GetComponent <GhostStateManager>();
 }
Example #8
0
 // Use this for initialization
 void Start()
 {
     ghostStateManager = GetComponent <GhostStateManager>();
 }