/// <summary> /// Set the parameters that all actions have in common. There may be an additional function for setting parameters specific to a particular action. /// </summary> /// <param name="aea">Action wrapper.</param> /// <param name="name">Name of action.</param> /// <param name="priority">Priority of action when placed in queue (lower number is higher priority).</param> /// <param name="timeCost">The amount of time required to carry out the action. If there is not enough time, the action will be placed back on the queue (which could be periodically cleared).</param> /// <param name="resourceCosts">The resource costs for performing the action. These costs don't take effect unless the creature has enough resources.</param> public static void setBasicActionParams(ActionEditorAbstract aea, string name, int priority, int timeCost, Dictionary <string, float> resourceCosts) { aea.setName(name); aea.setPriority(priority); aea.setTimeCost(timeCost); // add resource costs if (resourceCosts != null) { foreach (string key in resourceCosts.Keys) { aea.addResourceCost(key, resourceCosts[key]); } } }
// puser picks sensory input node as the type they would like to create public void setCreator(ActionCreatorType type) { actionType = type; switch (type) { case ActionCreatorType.commActionCreator: // now node will be modified by siNodeCreator actionCreator = new CommActionEditor(new CommAction()); break; case ActionCreatorType.moveActionCreator: // now node will be modified by siNodeCreator actionCreator = new MoveActionEditor(new MoveAction()); break; case ActionCreatorType.consumeCreator: actionCreator = new ConsumeFromLandEditor(new ConsumeFromLand()); break; case ActionCreatorType.reproduceCreator: actionCreator = new ReproActionEditor(new ReproAction()); break; case ActionCreatorType.convertEditor: actionCreator = new ConvertEditor(new Convert()); break; case ActionCreatorType.depositEditor: actionCreator = new DepositEditor(new Deposit()); break; case ActionCreatorType.attackEditor: actionCreator = new AttackEditor(new Attack()); break; default: break; } // now this NodeCreator will now be passed to a gameObject ( or referenced by a gameObject) // that only displays node edits for it's type and only uses the variable for that kind of nodeCreator }