public void ApplyCharacterAction( ICharacterAction characterAction, InputActionParameterSet parameterSet) { parameterSet.SetParameter("character", this.Character); characterAction.ApplyAction(parameterSet); }
public ICharacterAction DequeueAction(ActionTree parent) { ICharacterAction rv; if (leftNode != null) { rv = leftNode.DequeueAction(this); } else { rv = root; if (parent != null) { // There should now be nothing to my left. Remove myself from the equation, // and make my parent look to my right from now on. parent.leftNode = rightNode; } else if (rightNode != null) { // Replace self with minimum action of the right node, removing it in the process. root = rightNode.DequeueAction(null); } else { root = null; // IS THIS CORRECT? } } return(rv); }
public InfluencedInteraction( int limiter, IEnumerable <Trait> strongTraitInfluences, IEnumerable <State> strongStateInfluences, ICharacterAction action ) : this(limiter) { foreach (Trait trait in strongTraitInfluences) { if (trait == null) { continue; } this.strongTraitInfluences[trait.type] = trait; } foreach (State state in strongStateInfluences) { if (state == null) { continue; } this.strongStateInfluences[state.name] = state; } actionID = action.ID; }
public PlayerWeaponStateAdapter(PlayerEntity playerEntity, ICharacterAction action, ICharacterPosture characterPosture, UiContext uiContext) { _playerEntity = playerEntity; _action = action; _characterPosture = characterPosture; _uiContext = uiContext; }
void OnPlayerClickedEnemy(IEvent e) { if (e is PlayerSelectedActionTargetEvent clk) { if (clk.Target == character) { awaitedAction = clk.Action; spriteRenderer.enabled = true; } } else if (e is CombatActionEvent act) { if (act.Target == character && act.Action == awaitedAction) { spriteRenderer.enabled = false; awaitedAction = null; } } else if (e is CharacterActionCancelledEvent cancelledEvent) { if (cancelledEvent.Action == awaitedAction) { spriteRenderer.enabled = false; awaitedAction = null; } } }
public GameInputMap CreateMapping(string name, ICharacterAction characterAction) { name = name.ToLower(); // Intentionally not checking if the key already exists; we want the exception to rise. this.mappings.Add(name, characterAction); return this; }
public bool CanApplyCharacterAction( ICharacterAction characterAction, InputActionParameterSet parameterSet) { // Make sure to clone the parameterset so we don't destroy/alter it. // (Probably doesn't matter? but feels like good practice). var clonedSet = parameterSet.Clone().SetParameter("character", this.Character); return characterAction.CanApplyAction(clonedSet); }
public void SetupChangeWeaponAnimation(ICharacterAction action) { if (null == action) { return; } WeaponAnimation.MountWeapon = action.Select; WeaponAnimation.UnMountWeapon = action.Holster; WeaponAnimation.ChangeWeapon = action.SwitchWeapon; WeaponAnimation.InterruptPlayerAnimation = action.InterruptAction; WeaponAnimation.InterruptChangeWeaponAnimation = action.InterruptSwitchWeapon; }
/* Actions */ public bool PerformAction(string id, ICollection <IEntity> targets) { ICharacterAction action = BrainRepo.GetAction(id); if (action == null) { return(false); } action.Perform(GetActionInfo(targets)); return(true); }
public void UpdatePlay(float playback_time) { if (gameObject.activeInHierarchy == false) { return; } try { PlaybackTime = playback_time; if (m_PlayingActions.Count > 0) { for (int i = 0; i < m_PlayingActions.Count;) { ICharacterAction action = m_PlayingActions[i]; if ((BattleBase.Instance == null || BattleBase.Instance.IsPause != ePauseType.Pause || action.IsPause == false) && action.Update(PlaybackTime) == false) { m_PlayingActions.RemoveAt(i); if (action == MainAction) { MainAction = null; } } else { ++i; } } } if (m_AnimationAdoptor != null && IsUpdateAnimation) { m_AnimationAdoptor.Update(PlaybackTime, m_FreezeCount > 0); } Tween.UpdatePlay(PlaybackTime); UpdateParticles(); if (Application.isPlaying == true && m_DefaultEffect != null && m_PlayingDefaultEffect == null) { m_PlayingDefaultEffect = PlayParticle(m_DefaultEffect); } else if (m_PlayingDefaultEffect != null && m_PlayingDefaultEffect.IsPlaying == true && m_PlayingDefaultEffect.IsFinish == false && CharacterAnimation.IsDeadEnd) { m_PlayingDefaultEffect.Finish(); } } catch (System.Exception ex) { throw new System.Exception(string.Format("[{0}] {1}", gameObject.name, ex.Message), ex); } }
public void EnqueueAction(ICharacterAction a) { a.SetStartingTick(currentTick); if (initiativeTracker == null) { initiativeTracker = new ActionTree(a); } else { initiativeTracker.EnqueueAction(a); } //PerformNextAction (); }
private void Awake() { character = GetComponent <ICharacterAction>(); if (PickUpArea) { if (AreaTrigger == null) { AreaTrigger = PickUpArea.GetComponent <TriggerProxy>(); if (AreaTrigger == null) { AreaTrigger = PickUpArea.gameObject.AddComponent <TriggerProxy>(); } } } else { Debug.LogWarning("Please set a Pick up Area"); } }
public void EnqueueAction(ICharacterAction action) { // This case should only happen IF all other actions // have been dequeued. if (root == null) { root = action; return; } // NOTE: The = means that for actions completing on the same tick, // actions enqueued later wil complete first. This makes sense because // those actions would logically be faster, so making them complete first // is consistent. if (action.GetCompletionTick() <= root.GetCompletionTick()) { if (leftNode == null) { leftNode = new ActionTree(action); } else { leftNode.EnqueueAction(action); } } else { if (rightNode == null) { rightNode = new ActionTree(action); } else { rightNode.EnqueueAction(action); } } }
private void PerformNextAction() { if (initiativeTracker == null) { return; } else { waiting = false; ICharacterAction a = initiativeTracker.DequeueAction(null); if (a != null) { a.DoAction(); currentTick = a.GetCompletionTick(); if (!(a is PauseAction)) { Debug.Log("Action" + a.GetType() + " completed at tick " + currentTick); } } waiting = true; EnqueueAction(a.GetInitiatingAI().GetNextAction()); } }
public CharacterActionCancelledEvent(ICharacter character, ICharacterAction action) : base(character) { this.action = action; }
public void NormalAttack(INormalAttack normalAttack) { _characterAction = new Attack(normalAttack); _characterAction.Execute(_characterTo); }
public PlayerSelectedActionTargetEvent(ICharacter user, ICharacter target, ICharacterAction action) { this.user = user; this.action = action; this.target = target; }
public void SpecialAttack(ISpecialPower specialPower) { _characterAction = new SpecialAttack(specialPower); _characterAction.Execute(_characterTo); }
public void RegisterAction(ICharacterAction a) { actions[a.ID] = a; }
public void AddAction(ICharacterAction action) { m_PlayingActions.Add(action); }
public CombatActionEvent(ICombatReader combat, ICharacter target, ICharacter actionDoer, ICharacterAction action) : base(combat) { this.target = target; this.actionDoer = actionDoer; this.action = action; }
public ActionTree(ICharacterAction action) { root = action; leftNode = null; rightNode = null; }