예제 #1
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get object to play particles on
            HeroKitObject[]  targetObject    = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            UnityObjectField unityObject     = UnityObjectFieldValue.GetValueA(heroKitObject, 2);
            ParticleSystem   particlesPrefab = (unityObject.value != null) ? (ParticleSystem)unityObject.value : null;
            bool             changePosition  = BoolValue.GetValue(heroKitObject, 3);
            bool             changeRotation  = BoolValue.GetValue(heroKitObject, 10);

            wait = BoolValue.GetValue(heroKitObject, 17);
            bool runThis = (targetObject != null && particlesPrefab != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], particlesPrefab, changePosition, changeRotation);
            }

            // set up the long action
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = wait;
            updateIsDone = false;
            heroKitObject.longActions.Add(this);

            // show debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Particle System: " + particleObject;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #2
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            string           title        = StringFieldValue.GetValueA(heroKitObject, 0);
            ShowSaveGameMenu showMenu     = new ShowSaveGameMenu();
            HeroKitObject    targetObject = showMenu.SetupSaveMenu(title, 2);
            bool             runThis      = (targetObject != null);

            if (runThis)
            {
                // menu was called from start menu
                bool calledFromStartMenu = BoolValue.GetValue(heroKitObject, 1);
                targetObject.heroList.bools.items[1].value = calledFromStartMenu;

                // enable the canvas
                Canvas canvas = targetObject.GetHeroComponent <Canvas>("Canvas");
                canvas.enabled = true;
            }

            if (heroKitObject.debugHeroObject)
            {
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject));
            }

            return(-99);
        }
예제 #3
0
        /// <summary>
        /// Get the name of a child object attached to a hero object.
        /// </summary>
        /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param>
        /// <param name="actionFieldIDA">ID assigned to action field A.</param>
        /// <param name="actionFieldIDB">ID assigned to action field B.</param>
        /// <returns></returns>
        public static string GetValue(HeroKitObject heroKitObject, int actionFieldIDA, int actionFieldIDB)
        {
            bool   onChild   = BoolValue.GetValue(heroKitObject, actionFieldIDA);
            string childName = (onChild) ? StringFieldValue.GetValueA(heroKitObject, actionFieldIDB) : "";

            return(childName);
        }
예제 #4
0
파일: Sink.cs 프로젝트: antfitch/HeroKit
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            float           timeToWait   = FloatFieldValue.GetValueA(heroKitObject, 2) + Time.time;
            float           speed        = FloatFieldValue.GetValueA(heroKitObject, 3);

            wait = !BoolValue.GetValue(heroKitObject, 4);
            bool runThis = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], timeToWait, speed);
            }

            // set up update for long action
            heroKitObject.heroState.heroEvent[eventID].waiting = wait;
            updateIsDone = false;
            heroKitObject.longActions.Add(this);

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Speed: " + speed;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #5
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;
            HeroKitObject[]  targetObject   = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 4);
            UnityObjectField unityObject    = UnityObjectFieldValue.GetValueA(heroKitObject, 1);
            AudioClip        audioClip      = (unityObject.value != null) ? (AudioClip)unityObject.value : null;
            bool             fadeBGM        = BoolValue.GetValue(heroKitObject, 2);
            bool             fadeBGS        = BoolValue.GetValue(heroKitObject, 3);
            bool             changeSettings = BoolValue.GetValue(heroKitObject, 5);
            bool             runThis        = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], audioClip, fadeBGM, fadeBGS, changeSettings);
            }

            // set up the long action
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = true;
            updateIsDone = false;
            heroKitObject.longActions.Add(this);

            // show debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "SE: " + audioClip;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
        protected override void DoAction(CATContext context)
        {
            var gobj = cinemachineFreeLookCam.First(context);

            if (gobj == null)
            {
                return;
            }
            cam = gobj.GetComponentInChildren <CinemachineFreeLook>();
            if (cam == null)
            {
                return;
            }
            setXCached = setX.GetValue(context);
            setYCached = setY.GetValue(context);

            if (setXCached)
            {
                originalXAxisName           = cam.m_XAxis.m_InputAxisName;
                cam.m_XAxis.m_InputAxisName = newXAxisName.GetValue(context);
            }
            if (setYCached)
            {
                originalYAxisName           = cam.m_YAxis.m_InputAxisName;
                cam.m_YAxis.m_InputAxisName = newYAxisName.GetValue(context);
            }
        }
예제 #7
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            GameObject    prefab          = PrefabValue.GetValue(heroKitObject, 0);
            GameObject    parent          = GameObjectFieldValue.GetValueA(heroKitObject, 1);
            int           count           = IntegerFieldValue.GetValueA(heroKitObject, 2);
            bool          incrementItemID = BoolValue.GetValue(heroKitObject, 3);
            HeroKitObject notifications   = HeroObjectFieldValue.GetValueA(heroKitObject, 4)[0];
            int           stateID         = EventValue.GetStateID(heroKitObject, 5);
            int           eventID         = EventValue.GetEventID(heroKitObject, 5);
            bool          runThis         = (prefab != null && parent != null);

            if (runThis)
            {
                CreateUIObjects(prefab, parent, count, incrementItemID, notifications, stateID, eventID, false);
            }

            //------------------------------------
            // debug message
            //------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Parent Game Object: " + parent + "\n" +
                                      "Object to Duplicate: " + prefab + "\n" +
                                      "Number of Duplicates: " + count + "\n" +
                                      "Increment Item ID: " + incrementItemID + "\n" +
                                      "Send Notifications Here: " + notifications + "\n" +
                                      "Notification State ID: " + stateID + "\n" +
                                      "Notification Event ID: " + eventID;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #8
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            HeroKitObject[] targetObject    = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            bool            changePrefab    = BoolValue.GetValue(heroKitObject, 2);
            GameObject      prefab          = (changePrefab) ? PrefabValue.GetValue(heroKitObject, 3) : null;
            bool            changeRigidbody = BoolValue.GetValue(heroKitObject, 4);
            Rigidbody       rigidbody       = (changeRigidbody) ? RigidbodyValue.GetValue(heroKitObject, 5) : null;
            bool            changeHidden    = BoolValue.GetValue(heroKitObject, 6);
            int             isHidden        = (changeHidden) ? DropDownListValue.GetValue(heroKitObject, 7) : 0;

            bool runThis = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], changePrefab, prefab, changeRigidbody, rigidbody, changeHidden, isHidden);
            }

            // show debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Result: " + prefab + " " + rigidbody;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #9
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // add menu to scene if it doesn't exist
            HeroKitObject targetObject = HeroKitCommonRuntime.GetPrefabFromAssets(HeroKitCommonRuntime.settingsInfo.optionsMenu, true);
            bool          runThis      = (targetObject != null);

            if (runThis)
            {
                targetObject.gameObject.SetActive(true);

                // menu was called from start menu
                bool calledFromStartMenu = BoolValue.GetValue(heroKitObject, 0);
                targetObject.heroList.bools.items[1].value = calledFromStartMenu;

                // enable the canvas
                Canvas canvas = targetObject.GetHeroComponent <Canvas>("Canvas");
                canvas.enabled = true;
            }

            if (heroKitObject.debugHeroObject)
            {
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject));
            }

            return(-99);
        }
예제 #10
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // add menu to scene if it doesn't exist
            HeroKitObject targetObject = HeroKitCommonRuntime.GetPrefabFromAssets(HeroKitCommonRuntime.settingsInfo.inventoryMenu, true);
            HeroObject    item         = null;
            int           count        = 0;
            bool          runThis      = (targetObject != null);

            if (runThis)
            {
                targetObject.gameObject.name = HeroKitCommonRuntime.settingsInfo.inventoryMenu.name;
                targetObject.gameObject.SetActive(true);

                // get the container for the inventory slots
                GameObject parent = HeroKitCommonRuntime.GetChildGameObject(targetObject.gameObject, "Inventory Menu Content");
                if (parent != null)
                {
                    // get the item we want to remove
                    item = HeroObjectFieldValue.GetValueC(heroKitObject, 0);
                    if (item != null)
                    {
                        // get the number of items to remove
                        bool addMultiple = BoolValue.GetValue(heroKitObject, 1);
                        count = (addMultiple) ? IntegerFieldValue.GetValueA(heroKitObject, 2) : 1;

                        // check to see if the inventory slot already exists in the menu
                        GameObject    gameObject = HeroKitCommonRuntime.GetChildGameObject(parent, item.name, false);
                        HeroKitObject heroObject = null;

                        // if the item exists, remove it
                        if (gameObject != null)
                        {
                            // get hero kit object
                            if (heroObject == null)
                            {
                                heroObject = heroKitObject.GetGameObjectComponent <HeroKitObject>("HeroKitObject", false, gameObject);
                            }

                            // add the # of items to add to integer variable list, slot 1
                            heroObject.heroList.ints.items[1].value = count;

                            // play event 2 in the hero kit object attached to this prefab
                            heroObject.PlayEvent(2);
                        }
                    }
                }
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Item: " + item + "\n" +
                                      "Count: " + count;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #11
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;
            HeroKitObject[]  targetObject   = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            UnityObjectField unityObject    = UnityObjectFieldValue.GetValueA(heroKitObject, 2);
            AudioClip        audioClip      = (unityObject.value != null) ? (AudioClip)unityObject.value : null;
            bool             changeSettings = BoolValue.GetValue(heroKitObject, 3);
            bool             runThis        = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], audioClip, changeSettings);
            }

            // show debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "BGM: " + audioClip;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #12
0
        // execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get the hero object where the parameters are stored
            HeroKitObject[]  targetObject    = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            UnityObjectField objectData      = UnityObjectFieldValue.GetValueA(heroKitObject, 2);
            string           scriptName      = (objectData.value != null) ? objectData.value.name : "";
            bool             enableComponent = BoolFieldValue.GetValueA(heroKitObject, 3);
            bool             setProperties   = BoolValue.GetValue(heroKitObject, 4);

            bool runThis = (targetObject != null && scriptName != "");

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], scriptName, enableComponent, setProperties);
            }

            // debug info
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "MonoScript: " + scriptName;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #13
0
 private void SetPortraitInfo(int portraitID,
                              int changePortrait, int portraitSprite, int flipImage,
                              int changeScale, int newScale, int changeXPos,
                              int newXPos, int changeYPos, int newYPos, int changeZPos, int newZPos)
 {
     // get values for left portrait
     uiDialog.changePortrait[portraitID] = BoolValue.GetValue(heroKitObject, changePortrait);
     if (uiDialog.changePortrait[portraitID])
     {
         UnityObjectField unityObject = UnityObjectFieldValue.GetValueA(heroKitObject, portraitSprite);
         uiDialog.portraitSprite[portraitID] = (unityObject.value != null) ? (Sprite)unityObject.value : null;
         uiDialog.flipImage[portraitID]      = BoolValue.GetValue(heroKitObject, flipImage);
         uiDialog.changeScale[portraitID]    = BoolValue.GetValue(heroKitObject, changeScale);
         if (uiDialog.changeScale[portraitID])
         {
             uiDialog.newScale[portraitID] = FloatFieldValue.GetValueA(heroKitObject, newScale) * 0.01f;
         }
         uiDialog.changeXPos[portraitID] = BoolValue.GetValue(heroKitObject, changeXPos);
         if (uiDialog.changeXPos[portraitID])
         {
             uiDialog.newXPos[portraitID] = FloatFieldValue.GetValueA(heroKitObject, newXPos);
         }
         uiDialog.changeYPos[portraitID] = BoolValue.GetValue(heroKitObject, changeYPos);
         if (uiDialog.changeYPos[portraitID])
         {
             uiDialog.newYPos[portraitID] = FloatFieldValue.GetValueA(heroKitObject, newYPos);
         }
         uiDialog.changeZPos[portraitID] = BoolValue.GetValue(heroKitObject, changeZPos);
         if (uiDialog.changeZPos[portraitID])
         {
             uiDialog.newZPos[portraitID] = DropDownListValue.GetValue(heroKitObject, newZPos);
         }
     }
 }
예제 #14
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;
            HeroKitObject[] targetObject  = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            int             speed         = IntegerFieldValue.GetValueA(heroKitObject, 2);
            int             moveType      = DropDownListValue.GetValue(heroKitObject, 3); // 4-way or 8-way?
            int             animationType = DropDownListValue.GetValue(heroKitObject, 4); // 4-way or 8-way?
            bool            changeSpeed   = BoolValue.GetValue(heroKitObject, 5);
            bool            changeMove    = BoolValue.GetValue(heroKitObject, 6);
            bool            changeAnim    = BoolValue.GetValue(heroKitObject, 7);
            bool            runThis       = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], speed, moveType, animationType, changeSpeed, changeMove, changeAnim);
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "";
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #15
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;
            HeroKitObject[] targetObject    = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            bool            includeChildren = BoolValue.GetValue(heroKitObject, 2);
            int             newLayer        = DropDownListValue.GetValue(heroKitObject, 3) - 1;
            bool            runThis         = (targetObject != null && newLayer != -1);

            // note: debug info needs to go first for this action because
            // if you put it after state is changed, the wrong action is printed to log
            // debug info
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Layer: " + newLayer + "\n" +
                                      "Include Children: " + includeChildren;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], includeChildren, newLayer);
            }

            // normal return
            return(-99);
        }
예제 #16
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;

            HeroKitObject[] targetObject    = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            bool            changeStartAnim = BoolValue.GetValue(heroKitObject, 2);
            bool            changeEndAnim   = BoolValue.GetValue(heroKitObject, 6);
            bool            runThis         = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], changeStartAnim, changeEndAnim);
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string jumpBegin    = (moveObject != null) ? moveObject.animationJumpBegin : "";
                string jumpEnd      = (moveObject != null) ? moveObject.animationJumpEnd : "";
                string debugMessage = "Jump Begin Animation: " + jumpBegin + "\n" +
                                      "Jump End Animation: " + jumpEnd;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #17
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            float           force        = FloatFieldValue.GetValueA(heroKitObject, 2);

            wait = !BoolValue.GetValue(heroKitObject, 4);
            bool runThis = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], force);
            }

            // set up the long action
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = wait;
            updateIsDone = false;
            heroKitObject.longActions.Add(this);

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Force: " + force;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #18
0
 private void Update(EvaluationContext context)
 {
     Result.Value = BoolValue.GetValue(context)
                        ? ResultForTrue.GetValue(context)
                        : ResultForFalse.GetValue(context);
     ResultForTrue.DirtyFlag.Clear();
     ResultForFalse.DirtyFlag.Clear();
 }
예제 #19
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            bool            changeMove   = BoolValue.GetValue(heroKitObject, 2);
            bool            changeFace   = BoolValue.GetValue(heroKitObject, 3);

            string[] moveNames = new string[0];
            if (changeMove)
            {
                moveNames = new string[9];

                // movement
                moveNames[0] = StringFieldValue.GetValueA(heroKitObject, 5);
                moveNames[1] = StringFieldValue.GetValueA(heroKitObject, 6);
                moveNames[2] = StringFieldValue.GetValueA(heroKitObject, 7);
                moveNames[3] = StringFieldValue.GetValueA(heroKitObject, 8);
                moveNames[4] = StringFieldValue.GetValueA(heroKitObject, 9);
                moveNames[5] = StringFieldValue.GetValueA(heroKitObject, 10);
                moveNames[6] = StringFieldValue.GetValueA(heroKitObject, 11);
                moveNames[7] = StringFieldValue.GetValueA(heroKitObject, 12);
                moveNames[8] = StringFieldValue.GetValueA(heroKitObject, 13);
            }

            string[] faceNames = new string[0];
            if (changeFace)
            {
                faceNames = new string[9];

                // face
                faceNames[0] = StringFieldValue.GetValueA(heroKitObject, 14);
                faceNames[1] = StringFieldValue.GetValueA(heroKitObject, 15);
                faceNames[2] = StringFieldValue.GetValueA(heroKitObject, 16);
                faceNames[3] = StringFieldValue.GetValueA(heroKitObject, 17);
                faceNames[4] = StringFieldValue.GetValueA(heroKitObject, 18);
                faceNames[5] = StringFieldValue.GetValueA(heroKitObject, 19);
                faceNames[6] = StringFieldValue.GetValueA(heroKitObject, 20);
                faceNames[7] = StringFieldValue.GetValueA(heroKitObject, 21);
                faceNames[8] = StringFieldValue.GetValueA(heroKitObject, 22);
            }

            bool runThis = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], moveNames, faceNames);
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "";
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #20
0
파일: BoolToInt.cs 프로젝트: still-scene/t3
        private void Update(EvaluationContext context)
        {
            var valueForTrue  = ResultForTrue.GetValue(context);
            var valueForFalse = ResultForFalse.GetValue(context);

            Result.Value = BoolValue.GetValue(context)
                               ? valueForTrue
                               : valueForFalse;
        }
        public override Deferred Run(CATContext context)
        {
            if (IsRunning)
            {
                return(base.Run(context));
            }
            Deferred result = base.Run(context);

            axis = inputAxisName.GetValue(context);
            if (string.IsNullOrEmpty(axis))
            {
                Stop();
                return(result);
            }
            GameObject gobj = cinemachineFreeLookCam.First(context);

            if (gobj == null)
            {
                Stop();
                return(result);
            }
            cam = gobj.GetComponentInChildren <CinemachineFreeLook>();
            if (cam == null)
            {
                Stop();
                return(result);
            }
            if (!CinemachineCore.Instance.IsLive(cam))
            {
                Stop();
                return(result);
            }

            bailRot           = bailOnRotate.GetValue(context);
            bailMov           = bailOnMove.GetValue(context);
            rotToleranceDot   = subjectRotateTolerance.GetValue(context).AngleToDot();
            moveToleranceSqr  = subjectMoveTolerance.GetValue(context);
            moveToleranceSqr *= moveToleranceSqr;
            //camTransform = CinemachineCore.Instance.GetActiveBrain(0).OutputCamera.transform;

            centerX = centerXAxis.GetValue(context);
            centerY = centerYAxis.GetValue(context);

            originalXActive     = cam.m_XAxis.m_Recentering.m_enabled;
            originalYActive     = cam.m_YAxis.m_Recentering.m_enabled;
            originalCenterTimeX = cam.m_XAxis.m_Recentering.m_RecenteringTime;
            originalCenterTimeY = cam.m_YAxis.m_Recentering.m_RecenteringTime;
            originalWaitTimeX   = cam.m_XAxis.m_Recentering.m_WaitTime;
            originalWaitTimeY   = cam.m_YAxis.m_Recentering.m_WaitTime;

            if (!(centerX && centerY))
            {
                Stop();
            }

            return(result);
        }
예제 #22
0
        private void Update(EvaluationContext context)
        {
            var trueValue  = ForTrue.GetValue(context);
            var falseValue = ForFalse.GetValue(context);

            Result.Value = BoolValue.GetValue(context)
                               ? trueValue
                               : falseValue;
        }
예제 #23
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;
            String imageGroupPrefabName = "HeroKit Image Canvas";
            String imagePrefabName      = "HeroKit Image Sprite";
            int    imageID = IntegerFieldValue.GetValueA(heroKitObject, 0);
            int    speed   = IntegerFieldValue.GetValueA(heroKitObject, 1);
            float  scale   = IntegerFieldValue.GetValueA(heroKitObject, 2) * 0.01f;

            wait = BoolValue.GetValue(heroKitObject, 3);
            HeroKitObject targetObject = null;
            Vector3       currentScale = new Vector3();
            Vector3       targetScale  = new Vector3();

            // get the game object that contains the images
            GameObject imageGroup = GetImageGroup(imageGroupPrefabName);

            if (imageGroup != null)
            {
                // get the game object that contains the image
                GameObject imageObject = GetImage(imagePrefabName, imageID, imageGroup);
                if (imageObject != null)
                {
                    // get the hero kit object
                    targetObject = heroKitObject.GetGameObjectComponent <HeroKitObject>("HeroKitObject", false, imageObject);

                    // get the current position
                    currentScale = targetObject.transform.localScale;
                    targetScale  = new Vector3(scale, scale, targetObject.transform.localScale.z);
                }
            }

            // pan the camera
            uiScale             = targetObject.GetHeroComponent <UIScale>("UIScale", true);
            uiScale.targetScale = targetScale;
            uiScale.speed       = speed;
            uiScale.Initialize();

            // set up update for long action
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = wait;
            updateIsDone = false;
            heroKitObject.longActions.Add(this);

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Image ID: " + imageID + "\n" +
                                      "Scale: " + scale * 100 + "\n" +
                                      "Speed: " + speed;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #24
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // Get the scene object
            string  sceneName      = UnityObjectFieldValue.GetValueA(heroKitObject, 0).sceneName;
            Vector3 cameraPosition = new Vector3();
            Vector3 cameraRotation = new Vector3();
            bool    runThis        = (sceneName != "");

            if (runThis)
            {
                bool useDefaultScene     = BoolValue.GetValue(heroKitObject, 1);
                bool removeNonPersistent = BoolValue.GetValue(heroKitObject, 2);
                bool saveCurrentScene    = !BoolValue.GetValue(heroKitObject, 3);

                // get position
                bool    getPosition     = BoolValue.GetValue(heroKitObject, 4);
                Vector3 defaultPosition = new Vector3(-999999, -999999, -999999);
                cameraPosition = (getPosition) ? CoordinatesValue.GetValue(heroKitObject, 5, 6, 7, 8, 9, 10, defaultPosition) : defaultPosition;

                // get rotation
                bool    getRotation     = BoolValue.GetValue(heroKitObject, 11);
                Vector3 defaultRotation = new Vector3(-999999, -999999, -999999);
                cameraRotation = (getRotation) ? CoordinatesValue.GetValue(heroKitObject, 12, 13, 14, 15, 16, 17, defaultRotation) : defaultRotation;

                // Save the current scene
                if (saveCurrentScene)
                {
                    SaveScene saveScene = new SaveScene();
                    saveScene.SaveSceneData(heroKitObject, false); // save scene objects
                    saveScene.SaveSceneData(heroKitObject, true);  // save persistent objects
                }

                // Load the scene. Load any cached data for the scene.
                HeroKitCommonScene.LoadScene(sceneName, useDefaultScene, removeNonPersistent, cameraPosition, cameraRotation);

                // set up update for long action
                eventID = heroKitObject.heroStateData.eventBlock;
                heroKitObject.heroState.heroEvent[eventID].waiting = true;
                updateIsDone = false;
                heroKitObject.longActions.Add(this);
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Scene ID: " + sceneName + "\n" +
                                      "Camera Position: " + cameraPosition + "\n" +
                                      "Camera Rotation: " + cameraRotation;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            // Return value
            return(-99);
        }
예제 #25
0
        // Gets objects in a scene that match a certerin criteria
        public int Execute(HeroKitObject hko)
        {
            // Get variables
            heroKitObject = hko;
            SceneObjectValueData objectData = SceneObjectValue.GetValue(heroKitObject, 0, 1, false);
            HeroKitListenerUI    listener   = null;

            if (objectData.heroKitObject != null)
            {
                listener = objectData.heroKitObject[0].GetHeroComponent <HeroKitListenerUI>("HeroKitListenerUI");
            }
            else if (objectData.gameObject != null)
            {
                listener = heroKitObject.GetGameObjectComponent <HeroKitListenerUI>("HeroKitListenerUI", false, objectData.gameObject[0]);
            }

            if (listener != null)
            {
                // get item id
                bool getItemID = BoolValue.GetValue(heroKitObject, 2);
                if (getItemID)
                {
                    listener.itemID = IntegerFieldValue.GetValueA(heroKitObject, 3);
                }

                // get item
                bool getItem = BoolValue.GetValue(heroKitObject, 9);
                if (getItem)
                {
                    listener.item = HeroObjectFieldValue.GetValueC(heroKitObject, 10);
                }

                // get hero kit object, state, and event to play
                bool getEvent = BoolValue.GetValue(heroKitObject, 6);
                if (getEvent)
                {
                    listener.sendNotificationsHere = HeroObjectFieldValue.GetValueA(heroKitObject, 7)[0];
                    listener.stateID = EventValue.GetStateID(heroKitObject, 8);
                    listener.eventID = EventValue.GetEventID(heroKitObject, 8);
                }
            }

            //------------------------------------
            // debug message
            //------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Listener: " + listener;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #26
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            SceneObjectValueData data = SceneObjectValue.GetValue(heroKitObject, 0, 1, false);

            GameObject[] targetObject = HeroKitCommonRuntime.GetGameObjectsFromSceneObjects(data);
            Vector3      position     = new Vector3();
            bool         changeX      = false;
            bool         changeY      = false;
            bool         changeZ      = false;
            bool         runThis      = (targetObject != null && targetObject.Length > 0);

            // get value from first game object in list
            if (runThis)
            {
                position = targetObject[0].transform.localEulerAngles;

                changeX = BoolValue.GetValue(heroKitObject, 2);
                if (changeX)
                {
                    FloatFieldValue.SetValueB(heroKitObject, 3, position.x);
                }

                changeY = BoolValue.GetValue(heroKitObject, 4);
                if (changeY)
                {
                    FloatFieldValue.SetValueB(heroKitObject, 5, position.y);
                }

                changeZ = BoolValue.GetValue(heroKitObject, 6);
                if (changeZ)
                {
                    FloatFieldValue.SetValueB(heroKitObject, 7, position.z);
                }
            }

            //-----------------------------------------
            // debugging stuff
            //-----------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string xStr         = (changeX) ? "X: " + position.x + " " : "";
                string yStr         = (changeY) ? "Y: " + position.y + " " : "";
                string zStr         = (changeZ) ? "Z: " + position.z + " " : "";
                string debugMessage = "Rotation coordinates: " + xStr + yStr + zStr;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #27
0
        // get rotation to use
        private Quaternion GetRotation()
        {
            bool       changeRotation = BoolValue.GetValue(heroKitObject, 13);
            Quaternion rotation       = new Quaternion();

            if (changeRotation)
            {
                Vector3 eulerAngles = CoordinatesValue.GetValue(heroKitObject, 14, 15, 16, 17, 18, 19, new Vector3());
                rotation = Quaternion.Euler(eulerAngles);
            }

            return(rotation);
        }
예제 #28
0
        // get position to use
        private Vector3 GetPosition()
        {
            // get position to spawn
            bool    changePosition = BoolValue.GetValue(heroKitObject, 6);
            Vector3 position       = new Vector3();

            if (changePosition)
            {
                position = CoordinatesValue.GetValue(heroKitObject, 7, 8, 9, 10, 11, 12, new Vector3());
            }

            return(position);
        }
        // Gets objects in a scene that match a certerin criteria
        public int Execute(HeroKitObject hko)
        {
            // Get variables
            heroKitObject = hko;
            eventID       = heroKitObject.heroStateData.eventBlock;
            int actionCount = heroKitObject.heroState.heroEvent[eventID].actions.Count;

            //-----------------------------------------
            // Get the game objects in the scene that match specific parameters
            //-----------------------------------------
            int                  actionType     = DropDownListValue.GetValue(heroKitObject, 0);
            int                  getHeroFieldID = 1;
            int                  objectCount    = IntegerFieldValue.GetValueA(heroKitObject, 2);
            GameObject           targetObject   = HeroObjectFieldValue.GetValueA(heroKitObject, 3)[0].gameObject;
            List <HeroKitObject> listObjects    = HeroObjectFieldValue.GetValueB(heroKitObject, 10);

            // convert list objects to array
            HeroKitObject[] arrayObjects = (listObjects != null) ? listObjects.ToArray() : null;

            bool getX = BoolValue.GetValue(heroKitObject, 4);
            bool getY = BoolValue.GetValue(heroKitObject, 5);
            bool getZ = BoolValue.GetValue(heroKitObject, 6);

            float x = (getX) ? FloatFieldValue.GetValueA(heroKitObject, 7) : 0;
            float y = (getY) ? FloatFieldValue.GetValueA(heroKitObject, 8) : 0;
            float z = (getZ) ? FloatFieldValue.GetValueA(heroKitObject, 9) : 0;

            Vector3 radius = new Vector3(x, y, z);

            // filter the hero kit objects in the scene
            List <HeroKitObject> filteredObjects = HeroActionCommonRuntime.GetHeroObjectsDistance(heroKitObject, arrayObjects, objectCount, radius, getX, getY, getZ, targetObject);

            // assign the hero kit objects to the list
            HeroActionCommonRuntime.AssignObjectsToList(heroKitObject, getHeroFieldID, filteredObjects, actionType);

            //-----------------------------------------
            // debugging stuff
            //-----------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string xStr         = (getX) ? "X: " + x + " " : "";
                string yStr         = (getY) ? "Y: " + y + " " : "";
                string zStr         = (getZ) ? "Z: " + z + " " : "";
                string countStr     = (filteredObjects != null) ? filteredObjects.Count.ToString() : 0.ToString();
                string debugMessage = "Get objects in this radius: " + xStr + yStr + zStr + "\n" +
                                      "Objects found: " + countStr;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
예제 #30
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            bool            changeX      = BoolValue.GetValue(heroKitObject, 2);
            Vector3         degrees      = new Vector3();

            if (changeX)
            {
                degrees.z = IntegerFieldValue.GetValueA(heroKitObject, 3);
            }
            bool changeY = BoolValue.GetValue(heroKitObject, 4);

            if (changeY)
            {
                degrees.y = IntegerFieldValue.GetValueA(heroKitObject, 5);
            }
            bool changeZ = BoolValue.GetValue(heroKitObject, 6);

            if (changeZ)
            {
                degrees.x = IntegerFieldValue.GetValueA(heroKitObject, 7);
            }
            int  speed   = IntegerFieldValue.GetValueA(heroKitObject, 8);
            bool runThis = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], speed, degrees);
            }

            // set up update for long action
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = true;
            updateIsDone = false;
            heroKitObject.longActions.Add(this);

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Speed: " + speed + "\n" +
                                      "Euler Angles: " + degrees;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }