private void RecordSpawnAction(string owner, string unitToSpawn, Vector3 unitLocation, int unitId) { Action newAction = new Action(); newAction.Init(4, unitToSpawn, unitLocation, unitId); actionsInTurn.Add(newAction); }
private void PlayToyAction() { currentAction = cat.gameObject.AddComponent <PlayToyAction>(); // TODO use action to find nearstBall currentAction.Init(cat.gameObject, null); currentAction.StartAction(); }
public static IServiceCollection ConfigureAop(this IServiceCollection services, Action <IAspectConfiguration> config = null, bool isIgnoreError = true) { var(proxyGenerator, configServices) = config.Init(); var creator = new ProxyServiceDescriptorCreator(proxyGenerator); foreach (var item in services.ToArray()) { try { if (creator.TryCreate(item, out var proxy)) { var index = services.IndexOf(item); services.RemoveAt(index); services.Insert(index, proxy); } } catch (Exception) { if (!isIgnoreError) { throw; } } } foreach (var item in configServices) { item(services); } return(services); }
private void RecordMoveAction(string owner, int unitId, Vector3 targetLocation) { Action newAction = new Action(); newAction.Init(1, unitId, targetLocation); actionsInTurn.Add(newAction); //actionsLeft--; }
private void RecordAttackAction(string owner, int attackerId, int targetId) { Action newAction = new Action(); newAction.Init(2, attackerId, targetId); actionsInTurn.Add(newAction); //actionsLeft--; }
public virtual void Init() { health = new Health(); health.Init(); mana = new Mana(); mana.Init(); action = new Action(); action.Init(); }
public void RunAction(Action ac) { GameObject go = ac.GetGameObject(); if (actionList.ContainsKey(go)) { actionList.Remove(go); } actionList.Add(go, ac); ac.Init(); }
public Action CreateAction(string name, Role from, Role to, ActionConfig config) { GameObject actionHolder = PrafabUtils.Instance.create("ActionHolder"); Type type = Type.GetType(name); actionHolder.AddComponent(type); Action action = actionHolder.GetComponent <Action>(); action.Init(from, to, config); return(action); }
public bool play(ActionMask mask = ActionMask.Everything) { bool hasAnim = false; for (int i = 0, max = mActions.Count; i < max; ++i) { Action a = mActions[i]; if (((a.mMask & mask) != 0) && a.Init()) { hasAnim = true; a.mPlay = true; } } return(hasAnim); }
public void Activate(SequenceInstance sequence) { targetActor = Actor.GetActorByName(targetActorName); System.Type actionType = System.Type.GetType(actionClass); // validate variables? action = (Action)System.Activator.CreateInstance(actionType); if (action == null) { Debug.LogError("Invalid action class: " + actionClass); Complete(); return; } action.Init(sequence, this); action.OnActivate(); }
// Production // Rules database void InitRules() { // Define Actions runAwayAction.Init(actions.kRunAway, move); evadeAction.Init(actions.kEvade, move); goBackAction.Init(actions.kGoBack, move); informAction.Init(actions.kInform, move); wanderAction.Init(actions.kWander, move); // Define States onlySeeState.Init(enemyStates.kOnlySee, runAwayAction, 0.3f); onlyHearState.Init(enemyStates.kOnlyHear, evadeAction, 0.3f); seeAndHearState.Init(enemyStates.kSeeAndHear, goBackAction, 0.4f); seeAndHearAndInformState.Init(enemyStates.kSeeAndHearAndInform, informAction, 0.2f); informedState.Init(enemyStates.kInformed, goBackAction, 0.7f); nothingState.Init(enemyStates.kNothing, wanderAction, 0.1f); }
public override void Init() { health = new Health(); health.Init(); mana = new Mana(); mana.Init(); action = new Action(); action.Init(); deck = new CombatDeck(); deck.Init(); currentHand = new CombatHand(); discardHand = new CombatHand(); exileHand = new CombatHand(); }
public override void Init() { level = 1; health = new Health(); health.Init(); action = new Action(); action.Init(); mana = new Mana(); mana.Init(); UpdateStatsUI(); deck = new CombatDeck(); deck.Init(); currentDeck = new CombatDeck(deck); equippedTrinkets = new List <Enums.Trinket>(); unEquippedItems = new List <Enums.Equipment>(); appliedEffects = new Dictionary <Enums.AppliedEffect, int>(); isDead = false; }
public void Init(EnemyConfig config) { enemyType = config.type; name = config.name; health = new Health(); health.Init(config.health); mana = new Mana(); mana.Init(config.mana); action = new Action(); action.Init(config.action); deck = new CombatDeck(); deck.Init(config.deck); deck.Shuffle(); currentHand = new CombatHand(); discardHand = new CombatHand(); exileHand = new CombatHand(); appliedEffects = new Dictionary <Enums.AppliedEffect, int>(); isDead = false; }
private void StartNoneTargetAction(System.Type type) { currentAction = cat.gameObject.AddComponent(type) as Action; currentAction.Init(cat.gameObject, null); currentAction.StartAction(); }
private void RecordSpawnAction(string owner, string unitToSpawn, Vector3 unitLocation, int unitId ) { Action newAction = new Action(); newAction.Init(4, unitToSpawn, unitLocation, unitId); actionsInTurn.Add(newAction); }
private void RecordMoveAction( string owner , int unitId , Vector3 targetLocation ) { Action newAction = new Action(); newAction.Init(1, unitId, targetLocation); actionsInTurn.Add(newAction); //actionsLeft--; }
private void RecordAttackAction( string owner , int attackerId , int targetId) { Action newAction = new Action(); newAction.Init(2, attackerId, targetId); actionsInTurn.Add(newAction); //actionsLeft--; }
internal static GlobalDataList GatherDataList(string xaml) { var globalDataList = new GlobalDataList(); int index = 0; var createInstance = new CreateInstanceAction(globalDataList, null); var getObjectByProperty = new GetObjectByPropertyAction(globalDataList, null); var addExistInstance = new AddExistInstanceAction(globalDataList, null); var registerXName = new RegisterXNameAction(globalDataList, null); var setProperty = new SetPropertyAction(globalDataList, null); var addToCollectionProperty = new AddToCollectionPropertyAction(globalDataList, null); var addEvent = new AddEventAction(globalDataList, null); var setBindalbeProperty = new SetBindalbePropertyAction(globalDataList, null); var addObject = new CallAddMethodAction(globalDataList, null); var setDynamicResourceAction = new SetDynamicResourceAction(globalDataList, null); var addToResourceDictionaryAction = new AddToResourceDictionaryAction(globalDataList, null); var setBindingAction = new SetBindingAction(globalDataList, null); var otherActions = new OtherActions(globalDataList, null); Action currentOp = null; Action[] blockActions = new Action[] { new GatherAssembliesBlock(globalDataList, null), new GatherTypesBlock(globalDataList, null), new GatherPropertiesBlock(globalDataList, null), new GatherEventsBlock(globalDataList, null), new GatherMethodsBlock(globalDataList, null), new GatherBindablePropertiesBlock(globalDataList, null), new GatherLongStringsBlock(globalDataList, null) }; foreach (char c in xaml) { if (null == currentOp) { switch (c) { case '<': currentOp = blockActions[index++]; currentOp.Init(); break; case '{': currentOp = createInstance; currentOp.Init(); break; case '`': currentOp = getObjectByProperty; currentOp.Init(); break; case '@': currentOp = addExistInstance; currentOp.Init(); break; case '&': currentOp = registerXName; currentOp.Init(); break; case '[': currentOp = setProperty; currentOp.Init(); break; case '~': currentOp = addToCollectionProperty; currentOp.Init(); break; case '#': currentOp = addEvent; currentOp.Init(); break; case '!': currentOp = setBindalbeProperty; currentOp.Init(); break; case '$': currentOp = setDynamicResourceAction; currentOp.Init(); break; case '^': currentOp = addObject; currentOp.Init(); break; case '*': currentOp = addToResourceDictionaryAction; currentOp.Init(); break; case '%': currentOp = setBindingAction; currentOp.Init(); break; case 'a': currentOp = otherActions; currentOp.Init(); break; } } else { currentOp = currentOp.DealChar(c); } } foreach (var op in globalDataList.PreLoadOperations) { op.Do(); } return(globalDataList); }