Ejemplo n.º 1
0
    public void UpdateState()
    {
        if (enemy.m_waitTime <= enemy.m_chaseFreq && enemy.m_goalWaypoint != null)
        {
            enemy.UpdateJumpingAnimation();
        }
        else
        {
            if (m_isFirstRun)
            {
                enemy.UpdateGoalWaypoint(PrepEnemy());

                enemy.m_waitTime      = 0.0f;
                enemy.m_animationTime = 0.0f;
                enemy.m_isJumping     = true;

                m_isFirstRun = false;
            }
            else
            {
                ToReachBottomState();
            }
        }

        enemy.m_waitTime += Time.deltaTime;
    }
    public void UpdateState()
    {
        if (!FailSafe())
        {
            return;
        }

        if (enemy.m_waitTime <= enemy.m_chaseFreq && enemy.m_goalWaypoint != null)
        {
            enemy.UpdateJumpingAnimation();
        }
        else
        {
            if (enemy.m_goalWaypoint)
            {
                enemy.m_enemyAnchor.transform.position = enemy.m_goalWaypoint.position;
            }

            // Transition to chase mode when bottom of map is hit
            if (Mathf.Approximately(enemy.m_enemyAnchor.transform.position.y, enemy.m_mapManager.GetLowestWPInMap()))
            {
                ToExitState();
                return;
            }

            enemy.UpdateGoalWaypoint(GetStrafeWaypoint());

            enemy.m_waitTime      = 0.0f;
            enemy.m_animationTime = 0.0f;
            enemy.m_isJumping     = true;
        }

        enemy.m_waitTime += Time.deltaTime;
    }