private void OnChange(CollectionManager.CollectionType type, Action.Type actionType, int count, int changeValue) { if (type == collectionType) { UpdateValue(count); } }
public void AddCurrentAction(Action.Type type) { actions.Add(new Action() { time = Time.time - Game.instance.loopStart, type = type, executed = false }); }
public override bool SwitchActionCheck(Action.Type type) { SetTriggerNextAction(false); StopAction(); Debug.Log("trigger normal action"); return(true); }
public static void SetAction(ref Action action, Action.Type type) { Debug.Assert(pInstance != null); switch (type) { case Action.Type.Attack: action = pInstance.poActAttack; break; case Action.Type.SuperAttack: action = pInstance.poActSuperAttack; break; case Action.Type.Charge: action = pInstance.poActCharge; break; case Action.Type.Defend: action = pInstance.poActDefend; break; default: Debug.Assert(false); break; } }
public override bool SwitchActionCheck(Action.Type type) { isActionDone = true; SetTriggerNextAction(false); StopAction(); return(true); }
public void ReceiveAction(Action.Type actionType, int playerId) { if (actionType == Action.Type.move || isGrowing) { return; } else if (actionType == Action.Type.plant) { if (stage == Stage.seed) { GrowthAction(playerId); } } else if (actionType == Action.Type.water) { if (stage == Stage.sapling) { GrowthAction(playerId); } } else if (actionType == Action.Type.pick) { if (stage == Stage.tree) { GrowthAction(playerId); } } }
private void OnChange(CollectionManager.CollectionType type, Action.Type actionType, int count, int changeValue) { if (type == CollectionManager.CollectionType.COIN && actionType == Action.Type.ADD) { IncreaseXP(changeValue); } }
// Update is called once per frame void Update() { // Perform actions at random if (actions.Length > 0 && !IsPerformingAction()) { Debug.Log("Performing action..."); // Perform queued up action if there's one present Action action; if (nextAction != Action.Type.NONE) { action = GetActionByType(nextAction); nextAction = Action.Type.NONE; } // or just select a random idle action else { action = SelectIdleAction(); } // Check that we found an action with the specified type before executing if (action) { action.Execute(); } } }
public void OnClickDefend() { if (lastInput != Action.Type.Defend) { this.pPunTurnManager.SendMove(Action.Type.Defend, false); lastInput = Action.Type.Defend; } }
public void OnClickCharge() { if (lastInput != Action.Type.Charge) { this.pPunTurnManager.SendMove(Action.Type.Charge, false); lastInput = Action.Type.Charge; } }
public void OnClickUltiAttack() { if (lastInput != Action.Type.SuperAttack) { this.pPunTurnManager.SendMove(Action.Type.SuperAttack, false); lastInput = Action.Type.SuperAttack; } }
public virtual bool SwitchActionCheck(Action.Type type) { isActionDone = true; SetTriggerNextAction(false); StopAction(); Debug.Log("trigger normal action"); return(true); }
public void RegisterChangedPrimitive(DataPrimitive primitive, Action.Type type, params object[] parameters) { ObservedChangedPrimitives.Enqueue(new Action { primitive = primitive, type = type, parameters = parameters }); }
public void Unsubscribe(string source, Action.Type type, EventHandler <ActionArgs> function) { var key = new Action(machine.GetElementByName(source), type); if (actions.ContainsKey(key)) { actions[key] -= function; } }
public override bool SwitchActionCheck(Action.Type type) { if (type == Action.Type.Attack) { //isActionDone = true; SetTriggerNextAction (false); StopAction (); return true; } return false; }
void DoActions(IEnumerable <int> nodes, Action.Type type) { foreach (var o in nodes) { var action = new Action(o, type); if (actions.TryGetValue(action, out EventHandler <ActionArgs> act)) { act?.Invoke(this, new ActionArgs(o.ToString(), type)); } } }
/// <summary> /// Returns action with associated type, or null if none found /// </summary> protected Action GetActionByType(Action.Type type) { // If an action coroutine is in progress, return true foreach (Action action in actions) { if (action.type == type) { return(action); } } return(null); }
private void Update() { if (isPlayerVessel) { Action.Type actionMaybe = Action.fromInput; if (actionMaybe != Action.Type.none) { timeline.AddCurrentAction(actionMaybe); } } Action currentAction = timeline.currentAction; if (currentAction != null) { switch (currentAction.type) { case Action.Type.moveRight: transform.forward = Vector3.right; animator.SetBool(walkAnimBool, true); goingRight = true; rightPrecedes = true; break; case Action.Type.stopRight: animator.SetBool(walkAnimBool, false); goingRight = false; break; case Action.Type.moveLeft: transform.forward = Vector3.left; animator.SetBool(walkAnimBool, true); goingLeft = true; rightPrecedes = false; break; case Action.Type.stopLeft: animator.SetBool(walkAnimBool, false); goingLeft = false; break; case Action.Type.useObject: Lever.UseFromPosition(transform.position); break; } currentAction.executed = true; } rigidbody.velocity = new Vector3(velocityHorizontal, rigidbody.velocity.y, 0f); }
private void Change(ref int collection, Action.Type actionType, int changeValue) { switch (actionType) { case Action.Type.ADD: collection += changeValue; break; case Action.Type.SPEND: collection -= changeValue; break; case Action.Type.VALUE: collection = changeValue; break; } }
public bool SwitchAction(Action.Type type) { // can cancel action if (isActionDone || isCancelable) { isActionDone = true; return(true); } // can override action bool isNextAction = (triggerNextAction && nextAction != null && type == nextAction.GetType()); if (isNextAction) { isActionDone = true; return(true); } else { return(SwitchActionCheck(type)); } }
public void PlayAnimation(Action.Type actionType, Vector2 direction, bool isIdle = false) { string[] directionAnimations = idleDirectionAnimations; if (actionType == Action.Type.move) { actionBubble.SetActive(false); if (isIdle) { directionAnimations = idleDirectionAnimations; } else { directionAnimations = runDirectionAnimations; } } else if (actionType == Action.Type.plant) { directionAnimations = runDirectionAnimations; actionBubble.SetActive(true); actionIcon.sprite = Resources.Load <Sprite>(actionType.ToString()); } else if (actionType == Action.Type.water) { directionAnimations = runDirectionAnimations; actionBubble.SetActive(true); actionIcon.sprite = Resources.Load <Sprite>(actionType.ToString()); } else if (actionType == Action.Type.pick) { directionAnimations = runDirectionAnimations; actionBubble.SetActive(true); actionIcon.sprite = Resources.Load <Sprite>(actionType.ToString()); } int directionIndex = DirectionToIndex(direction, 8); //tell the animator to play the requested state animator.Play(directionAnimations[directionIndex]); }
public Action GetActionByType(Action.Type actionType) { return(actionTable[actionType]); }
public void ChangeWalls(Action.Type actionType, int changeValue) { Change(ref walls, actionType, changeValue); OnChange(CollectionType.WALL, actionType, walls, changeValue); }
public void ChangeShakes(Action.Type actionType, int changeValue) { Change(ref shakes, actionType, changeValue); OnChange(CollectionType.SHAKE, actionType, shakes, changeValue); }
public void ChangePrizes(Action.Type actionType, int changeValue) { Change(ref prizes, actionType, changeValue); OnChange(CollectionType.PRIZE, actionType, prizes, changeValue); }
public void ChangeCoins(Action.Type actionType, int changeValue) { Change(ref coins, actionType, changeValue); OnChange(CollectionType.COIN, actionType, coins, changeValue); }
public void newAction(Action.Priority priority, Action.Type type) { _actionQueue.Add(new Action(priority, type)); }
public override bool LoadProtoBuf(BehaviorPB.Node node) { if (!base.LoadProtoBuf(node)) return false; if (node.action == null) return false; scriptPath = node.action.script_path; actionType = (Action.Type)Type; return true; }
public void SetAction(Action.Type type) { ActionManager.SetAction(ref this.pAction, type); Debug.Assert(this.pAction != null); }
public int IncreaseExperience(Action.Type action) { return(Experience += (int)action); }
public ActionArgs(string source, Action.Type type) { Source = source; Type = type; }