Ejemplo n.º 1
0
    /// <summary>
    /// [AIEnd]
    /// 関数が実行登録を解除される際に呼ばれるコールバック関数
    /// 引数1: 通常実行→次回実行する関数, 割り込み実行の場合→現在の通常実行関数, 存在しない場合null
    /// 引数2: 並列関数として実行?
    /// </summary>
    public override void AIEnd(BaseAIFunction nextFunction)
    {
        navMeshAgent.isStopped = false;

        if (nextFunction != this)
        {
            m_animationController.editAnimation.SetStateStand();
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// [AIEnd]
    /// 関数が実行登録を解除される際に呼ばれるコールバック関数
    /// 引数1: 通常実行→次回実行する関数, 割り込み実行の場合→現在の通常実行関数, 存在しない場合null
    /// </summary>
    public override void AIEnd(BaseAIFunction nextFunction)
    {
        if (functionState == State.Rushing || functionState == State.Rotation)
        {
            m_animationController.editAnimation.SetTriggerReturnRun();
        }
        else if (functionState == State.Marking)
        {
            m_sePlayer.Stop(m_markingSEIndex);
            m_markingEffect.SetActive(false);
        }

        m_markPoint            = null;
        navMeshAgent.isStopped = false;
        functionState          = State.Null;
    }
Ejemplo n.º 3
0
    /// <summary>
    /// [AIBegin]
    /// 関数初回実行時に呼ばれるコールバック関数
    /// 引数1: 通常実行→終了する関数, 割り込み実行の場合→現在の通常実行関数, 存在しない場合null
    /// </summary>
    public override void AIBegin(BaseAIFunction beforeFunction)
    {
        if (m_markPoint == null)
        {
            return;
        }

        //加速度設定
        dogAIAgent.speedChanger.SetManualAcceleration(m_rushingAddAcceleration);

        //初期化
        SetUpdatePosition(true);
        navMeshAgent.destination = m_markPointPosition;
        functionState            = State.Rushing;
        //Animation Set
        m_animationController.editAnimation.SetTriggerRolling();
    }
Ejemplo n.º 4
0
    //Startみたいなもん
    public override void AIBegin(BaseAIFunction beforeFunction, bool isParallel)
    {
        //元クラスみたらだいたいわかるけど、よくつかうメンバを紹介


        //このAIAgentに紐付いているNavMeshAgent
        var s0 = navMeshAgent;
        //紐付いているAIAgent
        var s1 = aiAgent;
        //Begin実行からの秒数が入っている
        var s2 = timer;

        //AIAgentはRigidBodyと同じく独自に座標をもってる。そいつをいじるサポート関数
        //第一引数はtrueだと移動可能に, falseだと移動しなくなる
        //第二引数はtrueだと今の座標へワープを行う
        SetUpdatePosition(true);

        //現在実行中の関数, 外部からみたりね
        var s3 = aiAgent.nowFunction;
        //紐付いているRigidBody
        var s4 = aiAgent.rigidBody;
        //trueなら移動するようになる
        var s5 = aiAgent.navMeshUpdatePosition;
        //trueなら移動時回転するようになる
        var s6 = aiAgent.navMeshUpdateRotation;

        //関数を名前で検索する
        var s7 = aiAgent.FindFunction("", "");

        //RigidBodyのFreezeを一括設定してくれるヘルパー
        //結構スクリプトから設定するのだるいからね
        aiAgent.SetRigitFreezeAll();
        aiAgent.SetRigitFreezeExcludingPositionXZ();

        //加速度
        var s8 = navMeshAgent.acceleration;
        //速度
        var s9 = navMeshAgent.speed;

        //割り込み実行, 実行中のものは終了
        //aiAgent.ForceSpecifyFunction(null);
        //再割当て, 実行中のものは終了
        //aiAgent.AllocateFunction();
    }
Ejemplo n.º 5
0
    /// <summary>
    /// [AIBegin]
    /// 関数初回実行時に呼ばれるコールバック関数
    /// 引数1: 通常実行→終了する関数, 割り込み実行の場合→現在の通常実行関数, 存在しない場合null
    /// 引数2: 並列関数として実行?
    /// </summary>
    public override void AIBegin(BaseAIFunction beforeFunction)
    {
        if (dogAIAgent.isLinkPlayer && dogAIAgent.linkPlayerServantsOwnIndex >= 0)
        {
            navMeshAgent.updatePosition = true;

            m_followTransform = dogAIAgent.linkPlayer.transform;
            int playerID    = dogAIAgent.linkPlayer.GetInstanceID();
            int followIndex = 0;

            for (int i = 0, count = dogAIAgent.linkPlayerServantsOwnIndex; i < count; ++i)
            {
                var servant = ServantManager.instance.servantByPlayers[playerID][i];

                if (servant.isAccompanyingPlayer)
                {
                    ++followIndex;
                }
            }

            m_followTransform = PlayerAndTerritoryManager.instance.allPlayers
                                [dogAIAgent.linkPlayer.GetInstanceID()].playerInfo.followPoints[followIndex].transform;
        }


        Vector3 setDestination = m_followTransform.position;

        setDestination.y = transform.position.y;

        navMeshAgent.destination = setDestination;

        if (navMeshAgent.velocity.sqrMagnitude >=
            m_animationChangeSpeed * m_animationChangeSpeed)
        {
            m_animationController.editAnimation.SetStateRun();
        }
    }
Ejemplo n.º 6
0
 //OnDisableみたいなもん
 public override void AIEnd(BaseAIFunction nextFunction, bool isParallel)
 {
 }
Ejemplo n.º 7
0
 //Startみたいなもん
 public override void AIBegin(BaseAIFunction beforeFunction, bool isParallel)
 {
     //navMeshAgent.destination が目標地点
     navMeshAgent.destination = m_target.position;
 }
Ejemplo n.º 8
0
 //Startみたいなもん
 public override void AIBegin(BaseAIFunction beforeFunction, bool isParallel)
 {
     Debug.Log("Start left rotation");
 }
Ejemplo n.º 9
0
 //OnDisableみたいなもん
 public override void AIEnd(BaseAIFunction nextFunction, bool isParallel)
 {
     Debug.Log("End left rotation");
 }
Ejemplo n.º 10
0
 /// <summary>
 /// [AIEnd]
 /// 関数が実行登録を解除される際に呼ばれるコールバック関数
 /// 引数1: 通常実行→次回実行する関数, 割り込み実行の場合→現在の通常実行関数, 存在しない場合null
 /// 引数2: 並列関数として実行?
 /// </summary>
 public override void AIEnd(BaseAIFunction nextFunction)
 {
 }
Ejemplo n.º 11
0
 /// <summary>
 /// [AIBegin]
 /// 関数初回実行時に呼ばれるコールバック関数
 /// 引数1: 通常実行→終了する関数, 割り込み実行の場合→現在の通常実行関数, 存在しない場合null
 /// 引数2: 並列関数として実行?
 /// </summary>
 public override void AIBegin(BaseAIFunction beforeFunction)
 {
 }
Ejemplo n.º 12
0
 public override void AIBegin(BaseAIFunction beforeFunction, bool isParallel)
 {
     SetUpdatePosition(false);
 }