예제 #1
0
 private void DoGetFsmVariable()
 {
     if (!storeValue.IsNone)
     {
         InitFsmVar();
         storeValue.GetValueFrom(sourceVariable);
         storeValue.ApplyValueTo(targetVariable);
     }
 }
예제 #2
0
        void DoGetFsmVariable()
        {
            if (storeValue.IsNone)
            {
                return;
            }

            InitFsmVar();
            storeValue.GetValueFrom(sourceVariable);
            storeValue.ApplyValueTo(targetVariable);
        }
예제 #3
0
        private void DoSetFsmVariable()
        {
            setValue.UpdateValue();
            if (setValue.IsNone || string.IsNullOrEmpty(variableName.Value))
            {
                return;
            }

            var go = Fsm.GetOwnerDefaultTarget(eventTarget.gameObject);

            if (!go)
            {
                return;
            }

            if (enable.Value)
            {
                go.SetActive(true);
                if (eventTarget.fsmComponent != null)
                {
                    eventTarget.fsmComponent.enabled = true;
                }
            }

            string fsmName = eventTarget.fsmName.Value;

            if (go != cachedGameObject || fsmName != cachedFsmName)
            {
                targetFsm = ActionHelpers.GetGameObjectFsm(go, fsmName);

                if (targetFsm == null)
                {
                    return;
                }

                cachedGameObject = go;
                cachedFsmName    = fsmName;
            }

            if (variableName.Value != cachedVariableName)
            {
                setValue.UpdateValue();
                targetVariable     = targetFsm.FsmVariables.FindVariable(setValue.Type, variableName.Value);
                cachedVariableName = variableName.Value;
            }

            if (targetVariable == null)
            {
                LogWarning("Missing Variable: " + variableName.Value);
                return;
            }
            setValue.UpdateValue();
            setValue.ApplyValueTo(targetVariable);
        }
예제 #4
0
        private void DoSetFsmVariable()
        {
            if (setValue.IsNone || string.IsNullOrEmpty(variableName.Value))
            {
                return;
            }

            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            if (go != cachedGameObject || fsmName.Value != cachedFsmName)
            {
                targetFsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
                if (targetFsm == null)
                {
                    return;
                }
                cachedGameObject = go;
                cachedFsmName    = fsmName.Value;

                cachedVariableName = string.Empty; // invalidates variable cache
            }

            if (variableName.Value != cachedVariableName)
            {
                targetVariable     = targetFsm.FsmVariables.FindVariable(setValue.Type, variableName.Value);
                cachedVariableName = variableName.Value;
            }

            if (targetVariable == null)
            {
                LogWarning("Missing Variable: " + variableName.Value);
                return;
            }

            setValue.UpdateValue();
            setValue.ApplyValueTo(targetVariable);
        }
예제 #5
0
        private void DoSetFsmVariable()
        {
            if (setValue.IsNone || string.IsNullOrEmpty(variableName.Value))
            {
                return;
            }
            GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(gameObject);

            if (ownerDefaultTarget == null)
            {
                return;
            }
            if (ownerDefaultTarget != cachedGameObject || fsmName.Value != cachedFsmName)
            {
                targetFsm = ActionHelpers.GetGameObjectFsm(ownerDefaultTarget, fsmName.Value);
                if (targetFsm == null)
                {
                    return;
                }
                cachedGameObject = ownerDefaultTarget;
                cachedFsmName    = fsmName.Value;
            }
            if (variableName.Value != cachedVariableName)
            {
                targetVariable     = targetFsm.FsmVariables.FindVariable(setValue.Type, variableName.Value);
                cachedVariableName = variableName.Value;
            }
            if (targetVariable == null)
            {
                LogWarning("Missing Variable: " + variableName.Value);
            }
            else
            {
                setValue.ApplyValueTo(targetVariable);
            }
        }