示例#1
0
    private Vector2 CalculateTargetPosition()
    {
        Vector2    target     = Vector2.zero;
        GhostState ghostState = ghostStateManager.GetGhostState();

        switch (ghostState)
        {
        case GhostState.CHASE:
            target = GetTargetForChase();
            break;

        case GhostState.SCATTER:
            target = GetTargetForScatter();
            break;

        case GhostState.FRIGHTENED:
            target = GetTargetForFrightened();
            break;

        case GhostState.DEAD:
            target = HOME_DOOR;
            break;

        default:
            break;
        }

        return(target);
    }
示例#2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        ghost.velocity = direction * speed;

        if (stateManager.GetGhostState() == GhostState.DEAD)
        {
            ghost.velocity *= 2;
        }
    }
示例#3
0
 public void UpdateAnimator()
 {
     // TODO: improve this code
     if (ghostStateManager.GetGhostState().Equals(GhostState.FRIGHTENED))
     {
         animator.SetBool("isFrightened", true);
         animator.SetBool("isDead", false);
     }
     else if (ghostStateManager.GetGhostState().Equals(GhostState.DEAD))
     {
         animator.SetBool("isDead", true);
         animator.SetBool("isFrightened", false);
     }
     else
     {
         animator.SetBool("isFrightened", false);
         animator.SetBool("isDead", false);
     }
 }
    private void ReactToGhost(GhostStateManager ghostStateManager)
    {
        if (ghostStateManager.GetGhostState() == GhostState.FRIGHTENED)
        {
            ghostStateManager.Die();
//			ghostStateManager.gameObject.GetComponent<GhostController>().Die()...
        }
        else
        {
            gameController.Die();
        }
    }
示例#5
0
 private void UpdateGhostCounter()
 {
     if (currentGhost != null)
     {
         GhostStateManager ghostStateManager = currentGhost.GetGhostStateManager();
         if (ghostStateManager.GetGhostState() == GhostState.HOME)
         {
             ghostStateManager.IncrementDotCounter();
         }
         else
         {
             UpdateCurrentGhost();
         }
     }
 }
    // Update is called once per frame
    void FixedUpdate()
    {
        switch (ghostStateManager.GetGhostState())
        {
        case GhostState.HOME:
            Bounce();
            break;

        case GhostState.EXIT:
            GetOut();
            break;

        case GhostState.ENTER:
            GetIn();
            break;

        default:
            break;
        }
    }
示例#7
0
    // Update is called once per frame
    void Update()
    {
        switch (ghostStateManager.GetGhostState())
        {
        case GhostState.EXIT:
            HandleHouseExit();
            break;

        case GhostState.DEAD:
            HandleHouseEnter();
            break;

        case GhostState.ENTER:
            HandleHouseInside();
            break;

        default:
            break;
        }
    }