コード例 #1
0
        protected void DisableAction(AIActions aiAction)
        {
            switch (aiAction)
            {
            case AIActions.ClimbUp:
                if (climbUp == true)
                {
                    StartCoroutine(SetActiveAction(aiAction, true, 8f));
                }
                climbUp = false;
                break;

            case AIActions.JumpOver:
                if (jumpOver == true)
                {
                    StartCoroutine(SetActiveAction(aiAction, true, 5f));
                }
                jumpOver = false;
                break;

            case AIActions.StepUp:
                if (stepUp == true)
                {
                    StartCoroutine(SetActiveAction(aiAction, true, 5f));
                }
                stepUp = false;
                break;
            }
            _capsuleCollider.isTrigger = false;
            _rigidbody.useGravity      = true;
            agent.enabled = true;
            quickTurn     = false;
        }
コード例 #2
0
        /// <summary>
        /// Sets the active action with delay tme
        /// </summary>
        /// <returns>The active action.</returns>
        /// <param name="aiAction">Ai action.</param>
        /// <param name="value">If set to <c>true</c> value.</param>
        /// <param name="delay">Delay.</param>
        protected IEnumerator SetActiveAction(AIActions aiAction, bool value, float delay)
        {
            timeToEnableAction = delay;
            yield return(new WaitForSeconds(delay));

            SetActiveAction(aiAction, value);
        }
コード例 #3
0
        /// <summary>
        /// Sets the active action.
        /// </summary>
        /// <param name="aiAction">Ai action.</param>
        /// <param name="value">If set to <c>true</c> value.</param>
        protected void SetActiveAction(AIActions aiAction, bool value)
        {
            var layer = -1;

            switch (aiAction)
            {
            case AIActions.JumpOver:
                layer = jumpOverLayer;
                if (value == true && !useJumpOver)
                {
                    return;
                }
                if (value == true && layer > 1 && !JumpOverIsActive)
                {
                    agent.areaMask = agent.areaMask | (1 << layer);
                }
                else if (value == false && layer > 1 && JumpOverIsActive)
                {
                    agent.areaMask ^= (1 << layer);
                }
                JumpOverIsActive = value;
                break;

            case AIActions.StepUp:
                layer = stepUpLayer;
                if (value == true && !useStepUp)
                {
                    return;
                }
                if (value == true && layer > 1 && !StepUpIsActive)
                {
                    agent.areaMask = agent.areaMask | (1 << layer);
                }
                else if (value == false && layer > 1 && StepUpIsActive)
                {
                    agent.areaMask ^= (1 << layer);
                }
                StepUpIsActive = value;
                break;

            case AIActions.ClimbUp:
                layer = climbUpLayer;
                if (value == true && layer > 1 && !ClimbUpIsActive)
                {
                    agent.areaMask = agent.areaMask | (1 << layer);
                }
                else if (value == false && layer > 1 && ClimbUpIsActive)
                {
                    agent.areaMask ^= (1 << layer);
                }
                if (value == true && !useClimbUp)
                {
                    return;
                }
                ClimbUpIsActive = value;
                break;
            }
        }
コード例 #4
0
        protected bool ActionIsEnabled(AIActions aiAction)
        {
            var value = false;

            switch (aiAction)
            {
            case AIActions.JumpOver:
                value = JumpOverIsActive;
                break;

            case AIActions.StepUp:
                value = StepUpIsActive;
                break;

            case AIActions.ClimbUp:
                value = ClimbUpIsActive;
                break;
            }
            return(value);
        }
コード例 #5
0
        void DoAction(GameObject hitObject, ref bool action, AIActions aiAction)
        {
            var triggerAction = hitObject.transform.GetComponent <vTriggerAction>();

            if (!triggerAction)
            {
                Debug.LogWarning("Missing TriggerAction Component on " + hitObject.transform.name + "Object");
                return;
            }

            if (!actions)
            {
                matchTarget = triggerAction.target;
                var rot = hitObject.transform.rotation;
                transform.rotation = rot;
                animator.SetTrigger("ResetState");
                action = true;
                SetActiveAction(aiAction, false);
            }
        }
コード例 #6
0
ファイル: TaskElement.cs プロジェクト: jesterswilde/CP_Game
 public TaskElement(AIActions action, Transform trans)
 {
     _action = action;
     _trans  = trans;
 }
コード例 #7
0
ファイル: TaskElement.cs プロジェクト: jesterswilde/CP_Game
 public TaskElement(AIActions action, Vector3 target)
 {
     _target = target;
 }
コード例 #8
0
ファイル: TaskElement.cs プロジェクト: jesterswilde/CP_Game
 public TaskElement(AIActions action, float value)
 {
     _action = action;
     _value  = value;
 }
コード例 #9
0
ファイル: TaskElement.cs プロジェクト: jesterswilde/CP_Game
 public TaskElement(AIActions action)
 {
     _action = action;
 }