Esempio n. 1
0
    protected override void AIUpdate_undetect()
    {
        base.AIUpdate_undetect();
        float rand = GetAIRandomNumver();

        switch (aiState)
        {
        case AISTATE.AISELECT:
            if (rand < AddAIProbNum(aiStateNum_walk_ud))
            {
                SetAIState(AISTATE.APPROACH_WALK, 5.0f);
            }
            else if (rand < AddAIProbNum(aiStateNum_wait_ud))
            {
                SetAIState(AISTATE.WAIT, 3.0f);
            }
            else if (rand < AddAIProbNum(aiStateNum_rest_ud))
            {
                SetAIState(AISTATE.ATTACK, 5.0f);
            }
            break;

        case AISTATE.WAIT:
            break;

        case AISTATE.APPROACH_WALK:
            if (nowTargetPos == null)
            {
                rand         = GetAIRandomNumver();
                nowTargetPos = (Vector2)transform.position + new Vector2((rand > 50) ? 20 : -20, 0);
            }
            if (EnemyCtrl_antiFly.MoveToTarget_X(3.0f, (Vector2)nowTargetPos, moveSpeed))
            {
                SetAIState(AISTATE.WAIT, 2.0f);
                nowTargetPos = null;
            }
            break;

        case AISTATE.ATTACK:
            animator.SetTrigger("rest");
            SetAIState(AISTATE.WAIT, 5.0f);
            break;
        }
    }
Esempio n. 2
0
 protected override void AIUpdate_mapChenge()
 {
     base.AIUpdate_mapChenge();
     EnemyCtrl_antiFly.MoveToTarget_X(0.0f, mapChengeCtrl.GetNextLoadPosition(), EnemyCtrl_antiFly.MoveSpeed);
 }