예제 #1
0
        /**
         * <summary>Creates a new instance of the 'Variable: Set' Action, set to check a Local Vector3 variable</summary>
         * <param name = "localVariableID">The ID number of the variable</param>
         * <param name = "checkValue">The value to check for</param>
         * <returns>The generated Action</returns>
         */
        public static ActionVarCheck CreateNew_Local(int localVariableID, Vector3 checkValue)
        {
            ActionVarCheck newAction = (ActionVarCheck)CreateInstance <ActionVarCheck>();

            newAction.location     = VariableLocation.Local;
            newAction.variableID   = localVariableID;
            newAction.vector3Value = checkValue;
            return(newAction);
        }
예제 #2
0
        /**
         * <summary>Creates a new instance of the 'Variable: Set' Action, set to check a Local boolean variable</summary>
         * <param name = "localVariableID">The ID number of the variable</param>
         * <param name = "checkValue">The value to check for</param>
         * <returns>The generated Action</returns>
         */
        public static ActionVarCheck CreateNew_Local(int localVariableID, bool checkValue = true)
        {
            ActionVarCheck newAction = (ActionVarCheck)CreateInstance <ActionVarCheck>();

            newAction.location   = VariableLocation.Local;
            newAction.variableID = localVariableID;
            newAction.intValue   = (checkValue) ? 1 : 0;
            return(newAction);
        }
예제 #3
0
        /**
         * <summary>Creates a new instance of the 'Variable: Set' Action, set to check a Global string variable</summary>
         * <param name = "localVariableID">The ID number of the variable</param>
         * <param name = "checkValue">The value to check for</param>
         * <returns>The generated Action</returns>
         */
        public static ActionVarCheck CreateNew_Global(int globalVariableID, string checkValue)
        {
            ActionVarCheck newAction = (ActionVarCheck)CreateInstance <ActionVarCheck>();

            newAction.location    = VariableLocation.Global;
            newAction.variableID  = globalVariableID;
            newAction.stringValue = checkValue;
            return(newAction);
        }
예제 #4
0
        /**
         * <summary>Creates a new instance of the 'Variable: Set' Action, set to check a Component boolean variable</summary>
         * <param name = "variables">The associated Variables component</param>
         * <param name = "componentVariableID">The ID number of the variable</param>
         * <param name = "checkValue">The value to check for</param>
         * <returns>The generated Action</returns>
         */
        public static ActionVarCheck CreateNew_Component(Variables variables, int componentVariableID, bool checkValue = true)
        {
            ActionVarCheck newAction = (ActionVarCheck)CreateInstance <ActionVarCheck>();

            newAction.location   = VariableLocation.Component;
            newAction.variables  = variables;
            newAction.variableID = componentVariableID;
            newAction.intValue   = (checkValue) ? 1 : 0;
            return(newAction);
        }
예제 #5
0
        /**
         * <summary>Creates a new instance of the 'Variable: Set' Action, set to check a Component string variable</summary>
         * <param name = "variables">The associated Variables component</param>
         * <param name = "componentVariableID">The ID number of the variable</param>
         * <param name = "checkValue">The value to check for</param>
         * <returns>The generated Action</returns>
         */
        public static ActionVarCheck CreateNew_Component(Variables variables, int componentVariableID, string checkValue)
        {
            ActionVarCheck newAction = (ActionVarCheck)CreateInstance <ActionVarCheck>();

            newAction.location    = VariableLocation.Component;
            newAction.variables   = variables;
            newAction.variableID  = componentVariableID;
            newAction.stringValue = checkValue;
            return(newAction);
        }
예제 #6
0
        private void RunExampleTwo()
        {
            // Get the ActionList component
            ActionList actionList = CreateActionList();

            // Make sure we're in gameplay and that no Actions are already running
            if (actionList.AreActionsRunning() || !Application.isPlaying)
            {
                Debug.LogWarning("Cannot run Actions at this time", this);
                return;
            }

            // Create the Actions, but this time with references to them so that we can later modify their 'After running' options

            // Check if a global bool variable is True or False
            ActionVarCheck variableCheck = ActionVarCheck.CreateNew_Global(globalBoolVariableID);

            // Response if the variable is True
            ActionComment commentIfTrue = ActionComment.CreateNew("The bool variable is currently True!");

            // Response if the variable is False
            ActionComment commentIfFalse = ActionComment.CreateNew("The bool variable is currently False!");

            // Assign the Actions to the ActionList
            actionList.actions = new List <Action>
            {
                variableCheck,
                commentIfTrue,
                commentIfFalse,
            };

            // Modify the 'Variable: Check' Action's 'After running' fields so that commentIfTrue is run if the condition is met, and commentIfFalse is run otherwise
            variableCheck.SetOutputs(new ActionEnd(commentIfTrue), new ActionEnd(commentIfFalse));

            // Modify the two comment Actions so that their 'After running' fields are both set to Stop, so that the ActionList stops after either one is run
            commentIfTrue.SetOutput(new ActionEnd(true));
            commentIfFalse.SetOutput(new ActionEnd(true));

            // Run the ActionList
            actionList.Interact();
        }