Example #1
0
        private void AddPinNumber(int PinNumber)
        {
            if (pin.Length <= 3)
            {
                pin += PinNumber.ToString();
                UpdatePinIndicator(pin.Length);

                if (pin.Length == 4)
                {
                    if (matchPins)
                    {
                        if (!pin.Equals(pinCompare))
                        {
                            ClearPinNumber();
                            OnDoAction?.Invoke(this, new PinControlEvents(ACTIONS.PINS_NOT_MATCH, pin));
                        }
                        else
                        {
                            OnDoAction?.Invoke(this, new PinControlEvents(ACTIONS.GO_NEXT_VIEW, pin));
                        }
                    }
                    else
                    {
                        OnDoAction?.Invoke(this, new PinControlEvents(ACTIONS.GO_NEXT_VIEW, pin));
                    }
                }
            }
        }
        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));
            }
        }
Example #3
0
        public virtual void TriggerActionEvents()
        {
            DebugAction("TriggerAction Events ", gameObject);

            doingAction = true;

            // Call OnStartAction from the Controller's GenericAction inspector
            OnStartAction.Invoke();

            // Call OnDoAction from the Controller's GenericAction
            OnDoAction.Invoke(triggerAction);

            // trigger OnDoAction Event, you can add a delay in the inspector
            StartCoroutine(triggerAction.OnPressActionDelay(gameObject));
        }
        protected virtual void TriggerActionInput()
        {
            if (triggerAction == null)
            {
                return;
            }

            if (canTriggerAction)
            {
                if ((triggerAction.autoAction && actionConditions) || (actionInput.GetButtonDown() && actionConditions))
                {
                    if (!triggerActionOnce)
                    {
                        OnDoAction.Invoke(triggerAction);
                        TriggerAnimation();
                    }
                }
            }
        }
    public override void TriggerAnimation()
    {
        if (playingAnimation || actionStarted)
        {
            return;
        }
        doingAction = true;
        OnDoAction.Invoke(triggerAction);

        if (debugMode)
        {
            Debug.Log("TriggerAnimation", gameObject);
        }

        // trigger the animation behaviour & match target
        // if (!string.IsNullOrEmpty(triggerAction.playAnimation)) {
        //     playingAnimation = true;
        //     GetComponent<PhotonView>().RPC("CrossFadeInFixedTime", RpcTarget.All, triggerAction.playAnimation, 0.1f); // trigger the action animation clip
        // }



        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
                GetComponent <PhotonView>().RPC("CrossFadeInFixedTime", RpcTarget.All, 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));

        // bool to limit the autoAction run just once
        // if (triggerAction.autoAction || triggerAction.destroyAfter) triggerActionOnce = true;
        // new animation triggers dont have the concept of once

        // destroy the triggerAction if checked with destroyAfter
        if (triggerAction.destroyAfter)
        {
            StartCoroutine(DestroyActionDelay(triggerAction));
        }
    }