Example #1
0
 void Walking()
 {
     // 대기 시간이 아직 남았다면.
     if (waitTime > 0.0f)
     {
         // 대기 시간을 줄인다.
         waitTime -= Time.deltaTime;
         // 대기 시간이 없어지면.
         if (waitTime <= 0.0f)
         {
             // 범위 내의 어딘가.
             Vector2 randomValue = Random.insideUnitCircle * walkRange;
             // 이동할 곳을 설정한다.
             Vector3 destinationPosition = basePosition + new Vector3(randomValue.x, 0.0f, randomValue.y);
             // 목적지를 지정한다.
             SendMessage("SetDestination", destinationPosition);
         }
     }
     else
     {
         // 목적지에 도착한다.
         if (characterMove.Arrived())
         {
             // 대기 상태로 전환한다.
             waitTime = Random.Range(waitBaseTime, waitBaseTime * 2.0f);
         }
         // 타겟을 발견하면 추적한다.
         if (attackTarget)
         {
             ChangeState(State.Chasing);
         }
     }
 }
Example #2
0
 void Walking()
 {
     // 待機時間がまだあったら
     if (waitTime > 0.0f)
     {
         // 待機時間を減らす
         waitTime -= Time.deltaTime;
         // 待機時間が無くなったら
         if (waitTime <= 0.0f)
         {
             // 範囲内の何処か
             Vector2 randomValue = Random.insideUnitCircle * walkRange;
             // 移動先の設定
             Vector3 destinationPosition = basePosition + new Vector3(randomValue.x, 0.0f, randomValue.y);
             // 目的地の指定.
             SendMessage("SetDestination", destinationPosition);
         }
     }
     else
     {
         // 目的地へ到着
         if (characterMove.Arrived())
         {
             // 待機状態へ
             waitTime = Random.Range(waitBaseTime, waitBaseTime * 2.0f);
         }
         // ターゲットを発見したら追跡
         if (attackTarget)
         {
             ChangeState(State.Chasing);
         }
     }
 }
Example #3
0
    void Walking()
    {
        if (waitTime > 0.0f)
        {
            waitTime -= Time.deltaTime;
            if (waitTime <= 0.0f)
            {
                // 범위 내의 어딘가.
                Vector2 randomValue = Random.insideUnitCircle * walkRange;
                // 이동할 장소를 설정한다.
                Vector3 destinationPosition = basePosition + (Vector3)(randomValue);

                SendMessage("SetDestination", destinationPosition);
            }
        }
        else
        {
            // 목적지에 도착한다.
            if (characterMove.Arrived())
            {
                // 대기 상태로 전환한다.
                waitTime = Random.Range(waitBaseTime, waitBaseTime * 2.0f);
            }
            if (attackTarget)
            {
                ChangeState(State.Chasing);
            }
        }
    }
Example #4
0
    void Walking()
    {
        if (this.waitTime > 0.0f)
        {
            this.waitTime -= Time.deltaTime;

            if (this.waitTime <= 0.0f)
            {
                Vector2 randomValue         = Random.insideUnitCircle * walkRange;
                Vector3 destinationPosition = basePosition + new Vector3(randomValue.x, 0.0f, randomValue.y);
                SendMessage("SetDestination", destinationPosition);
            }
        }
        else
        {
            if (characterMove.Arrived())
            {
                waitTime = Random.Range(waitBaseTime, waitBaseTime * 2.0f);
            }

            if (attackTarget)
            {
                ChangeState(EnemyState.Chasing);
            }
        }
    }
Example #5
0
    //探索中
    void Walking()
    {
        anim.SetBool("is_Warg_Attack", false); //走るアニメージョンoff
        anim.SetBool("is_Warg_Run", true);     //走るアニメージョンon

        // 待機時間がまだあったら
        if (waitTime > 0.0f)
        {
            anim.SetBool("is_Warg_Run", false); //走るアニメージョンoff
            // 待機時間を減らす
            waitTime -= Time.deltaTime;
            // 待機時間が無くなったら
            if (waitTime <= 0.0f)
            {
                // ランダムに範囲内の何処か点を返す
                Vector2 randomValue = Random.insideUnitCircle * walkRange;
                // 移動先の設定
                Vector3 destinationPosition = basePosition + new Vector3(randomValue.x, 0.0f, randomValue.y);
                // 目的地の指定.
                SendMessage("SetDestination", destinationPosition);
            }
        }
        else
        {
            // 目的地へ到着
            if (characterMove.Arrived())
            {
                // 待機状態へ
                waitTime = Random.Range(waitBaseTime, waitBaseTime * 2.0f);
            }

            // ターゲットを発見したら追跡
            if (attackTarget)
            {
                //追跡ステートに移行
                ChangeState(State.Chasing);
            }
        }
    }