protected virtual void TriggerAnimation()
        {
            if (debugMode)
            {
                Debug.Log("TriggerAnimation");
            }

            // trigger the animation behaviour & match target
            if (!string.IsNullOrEmpty(triggerAction.playAnimation))
            {
                isPlayingAnimation = true;
                tpInput.cc.animator.CrossFadeInFixedTime(triggerAction.playAnimation, 0.1f);    // trigger the action animation clip
                tpInput.ChangeCameraState(triggerAction.customCameraState);                     // change current camera state to a custom
            }

            // trigger OnDoAction Event, you can add a delay in the inspector
            StartCoroutine(triggerAction.OnDoActionDelay(gameObject));

            // bool to limit the autoAction run just once
            if (triggerAction.autoAction || triggerAction.destroyAfter)
            {
                triggerActionOnce = true;
            }

            // destroy the triggerAction if checked with destroyAfter
            if (triggerAction.destroyAfter)
            {
                StartCoroutine(DestroyDelay(triggerAction));
            }
        }
Esempio n. 2
0
        public virtual void TriggerAnimation()
        {
            if (playingAnimation || actionStarted)
            {
                return;
            }

            DebugAction("TriggerAnimation ", gameObject);

            if (triggerAction.animatorActionState != 0)
            {
                DebugAction("Applied ActionState: " + triggerAction.animatorActionState + " ", gameObject);
                tpInput.cc.SetActionState(triggerAction.animatorActionState);
            }

            // trigger the animation behaviour & match target
            if (!string.IsNullOrEmpty(triggerAction.playAnimation))
            {
                if (!actionStarted)
                {
                    actionStarted    = true;
                    playingAnimation = true;
                    tpInput.cc.animator.CrossFadeInFixedTime(triggerAction.playAnimation, 0.1f);    // trigger the action animation clip
                    if (!string.IsNullOrEmpty(triggerAction.customCameraState))
                    {
                        tpInput.ChangeCameraState(triggerAction.customCameraState, true);           // change current camera state to a custom
                    }
                }
            }
            else
            {
                actionStarted = true;
            }
            animationBehaviourDelay = 0.2f;
        }
        public virtual void TriggerAnimation()
        {
            if (playingAnimation || actionStarted)
            {
                return;
            }
            doingAction = true;
            OnDoAction.Invoke(triggerAction);

            //triggerAction.OnPlayerExit.Invoke();
            if (debugMode)
            {
                Debug.Log("TriggerAnimation", gameObject);
            }

            if (triggerAction.animatorActionState != 0)
            {
                if (debugMode)
                {
                    Debug.Log("Applied ActionState: " + triggerAction.animatorActionState, gameObject);
                }
                tpInput.cc.SetActionState(triggerAction.animatorActionState);
            }

            // trigger the animation behaviour & match target
            if (!string.IsNullOrEmpty(triggerAction.playAnimation))
            {
                if (!actionStarted)
                {
                    actionStarted    = true;
                    playingAnimation = true;
                    tpInput.cc.animator.CrossFadeInFixedTime(triggerAction.playAnimation, 0.1f);    // trigger the action animation clip
                    if (!string.IsNullOrEmpty(triggerAction.customCameraState))
                    {
                        tpInput.ChangeCameraState(triggerAction.customCameraState, true);                 // change current camera state to a custom
                    }
                }
            }
            else
            {
                actionStarted = true;
            }
            animationBehaviourDelay = 0.2f;
            // trigger OnDoAction Event, you can add a delay in the inspector
            StartCoroutine(triggerAction.OnDoActionDelay(gameObject));
            // destroy the triggerAction if checked with destroyAfter
            if (triggerAction.destroyAfter)
            {
                StartCoroutine(DestroyActionDelay(triggerAction));
            }
        }
Esempio n. 4
0
    public virtual void HandleBuild()
    {
        if (!inBuildMode || !currentBuild)
        {
            return;
        }
        if (!string.IsNullOrEmpty(currentBuild.customCameraState))
        {
            tpInput.ChangeCameraState(currentBuild.customCameraState, true);
        }

        tpInput.MoveInput();

        currentBuild.HandleBuild(this);
        HandleBuildRotation();
    }