public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); var readyActions = Graph.Entity.Get <ReadyActions>(); if (readyActions == null) { return; } var actionConfig = readyActions.QueuedChange; var targetIndex = readyActions.QueuedSlot; if (actionConfig == null || readyActions.GetAction(targetIndex) == actionConfig) { readyActions.RemoveAction(targetIndex); actionConfig = null; } else { readyActions.EquipAction(actionConfig, targetIndex); } if (targetIndex == 0) { Graph.SetVariable(GraphVariables.Equipment, actionConfig != null ? actionConfig.Config.EquipVariable : ""); Graph.SetVariable(GraphVariables.WeaponModel, actionConfig != null ? actionConfig.Config.WeaponModel : ""); } readyActions.QueuedChange = null; }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); if (!_originalNode.Loop) { Graph.Entity.Post(new AnimationEventTriggered(Graph.Entity, _originalNode.EventName)); } }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); if (_component == null) { _component = Graph.Entity.Get <WeaponBobComponent>(); } }
public virtual void OnEnter(RuntimeStateNode previous) { if (!string.IsNullOrEmpty(Node.EnterEvent)) { Graph.Entity.Post(new AnimationEventTriggered(Graph.Entity, Node.EnterEvent)); } LastEnter = previous; TimeEntered = TimeManager.Time; }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); if (_poseAnimator == null) { _poseAnimator = Graph.Entity.Get <PoseAnimatorComponent>(); } Setup(); }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); _component = Graph.Entity.Get <FpPivotComponent>(); if (_component != null) { _origin = _component.Tr.localPosition; } _time = 0; }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); if (!_setup) { _animNode.Animation.LoadAsset(FinishSetup); } else { SetupAnimation(); } }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); if (!_setup) { _spriteNode.Sprite.LoadAsset(FinishSetup); } else { SetSprite(); } }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); if (!_setup) { var op = _spriteNode.Sprite.LoadAssetAsync <SpriteAnimation>(); op.Completed += FinishSetup; } else { SetSprite(); } }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); Graph.SetVariable(GraphVariables.Reloading, true); _ammo = Graph.Entity.Get <CurrentAction>().Value?.Ammo; if (_ammo == null) { return; } UIChargeCircle.ManualStart(_ammo.Config.ReloadText); _reloadPerAmmo = _ammo.ReloadSpeed / _ammo.Amount.MaxValue; _totalAmmo = _ammo.Amount.MaxValue - _ammo.Amount.Value; _current = 0; _reloadTimer = 0; }
protected virtual void SetCurrentNode(RuntimeStateNode node) { var last = Current; if (last != null) { last.OnExit(); } Current = node; if (Current == null) { GraphCompleted(); return; } Current.OnEnter(last); }
public override bool IsTrue(RuntimeStateNode node) { switch (Original.Comparison) { case ComparisonType.Equals: case ComparisonType.GreaterThan: case ComparisonType.EqualsOrGreaterThan: case ComparisonType.EqualsOrLessThan: return(Math.Abs(node.Graph.GetVariable <float>(Original.VariableName) - Value) < 0.001f); case ComparisonType.LessThan: case ComparisonType.NotEqualTo: return(Math.Abs(node.Graph.GetVariable <float>(Original.VariableName) - Value) > 0.001f); } return(false); }
public override bool IsTrue(RuntimeStateNode node) { switch (Original.Comparison) { case ComparisonType.Equals: case ComparisonType.GreaterThan: case ComparisonType.EqualsOrGreaterThan: case ComparisonType.EqualsOrLessThan: return(node.Graph.GetVariable <bool>(Original.VariableName) == Value); case ComparisonType.LessThan: case ComparisonType.NotEqualTo: return(node.Graph.GetVariable <bool>(Original.VariableName) != Value); } return(false); }
public override bool IsTrue(RuntimeStateNode node) { switch (Original.Comparison) { case ComparisonType.Equals: case ComparisonType.GreaterThan: case ComparisonType.EqualsOrGreaterThan: case ComparisonType.EqualsOrLessThan: return(node.Graph.Entity.Tags.Contain(Value)); case ComparisonType.LessThan: case ComparisonType.NotEqualTo: return(!node.Graph.Entity.Tags.Contain(Value)); } return(false); }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); // if (readyActions == null) { // return; // } // var actionConfig = readyActions.QueuedChange; // var targetIndex = readyActions.QueuedSlot; // if (actionConfig == null || readyActions.GetAction(targetIndex) == actionConfig) { // readyActions.RemoveAction(targetIndex); // actionConfig = null; // } // else { // readyActions.EquipAction(actionConfig, targetIndex); // } // if (targetIndex == 0) { // Graph.SetVariable(GraphVariables.Equipment, actionConfig != null ? actionConfig.Config.AnimationTrigger : ""); // Graph.SetVariable(GraphVariables.WeaponModel, actionConfig != null ? actionConfig.Config.WeaponModel : ""); // } // readyActions.QueuedChange = null; }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); var variable = Graph.GetVariable <string>(_originalNode.VariableName); _currentIndex = _originalNode.DefaultIndex; for (int i = 0; i < _originalNode.Values.Count; i++) { if (variable == _originalNode.Values[i]) { _currentIndex = i; break; } } _completed = false; if (ExternalGraph == null) { return; } ExternalGraph.Start(); }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); var action = Graph.Entity.Get <CurrentAction>()?.Value; if (action == null) { return; } _actionEntity = action.Entity; _owner = Graph.Entity.GetTemplate <ActionUsingTemplate>(); _config = _actionEntity.Get <BlockDamageAction>(); var model = ItemPool.Spawn(UnityDirs.Models, _config.ModelData, Vector3.zero, Quaternion.identity); if (model != null) { var spawnPivot = _actionEntity.Get <SpawnPivotComponent>(); spawnPivot.SetNewChild(model.Transform); _actionEntity.Add(new RenderingComponent(model.GetComponent <IRenderingComponent>())); _actionEntity.Add(new TransformComponent(model.transform)); } if (!Graph.Entity.Tags.Contain(EntityTags.Player)) { Graph.Entity.Add(new BlockDamageFlat()); _isWaiting = true; _vitalStat = null; return; } _vitalStat = _owner.Stats.GetVital(_config.TargetVital); var skillMulti = 1f; if (!string.IsNullOrEmpty(_config.Skill)) { var skillValue = _owner.Entity.FindStatValue(_config.Skill); skillMulti = Mathf.Clamp(1 - (skillValue * CostVital.SkillPercent), CostVital.SkillMaxReduction, 1); } Graph.Entity.GetOrAdd <RuleEventListenerComponent>().Handlers.Add(this); _fxComponent = action.Fx?.Value; _finalCost = _config.Cost * skillMulti; }
public override bool IsTrue(RuntimeStateNode node) { bool isAttacking = false; if (node.Graph.GetVariable <bool>(GraphVariables.Attacking)) { isAttacking = true; var action = node.Graph.Entity.Get <CurrentAction>().Value; if (action == null) { isAttacking = false; } else { var actionEntity = action.Entity; for (int i = 0; i < action.Config.Costs.Count; i++) { if (!action.Config.Costs[i].CanAct(node.Graph.Entity, actionEntity)) { isAttacking = false; break; } } } } switch (Original.Comparison) { case ComparisonType.Equals: case ComparisonType.GreaterThan: case ComparisonType.EqualsOrGreaterThan: case ComparisonType.EqualsOrLessThan: return(isAttacking == Value); case ComparisonType.LessThan: case ComparisonType.NotEqualTo: return(isAttacking != Value); } return(isAttacking); }
public override bool IsTrue(RuntimeStateNode node) { switch (Original.Comparison) { case ComparisonType.Equals: case ComparisonType.GreaterThan: case ComparisonType.EqualsOrGreaterThan: case ComparisonType.EqualsOrLessThan: if (node.Graph.IsGlobalTriggerActive(Original.Value)) { return(true); } break; case ComparisonType.LessThan: case ComparisonType.NotEqualTo: if (!node.Graph.IsGlobalTriggerActive(Original.Value)) { return(true); } break; } return(false); }
public abstract bool IsTrue(RuntimeStateNode node);
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); _sequence.Play(); }
public RuntimeNode(DummyStateNode node, RuntimeStateGraph graph) : base(node, graph) { _exitNode = GetOriginalNodeExit(); _timer = new UnscaledTimer(node._timer); }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); _completed = false; ExternalGraph.Start(); }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); Graph.GraphCompleted(); }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); _input = Graph.Entity.Get <PlayerInputComponent>(); }
public override void OnEnter(RuntimeStateNode lastNode) { base.OnEnter(lastNode); }
public void ChangeNode(RuntimeStateNode node) { SetCurrentNode(node); }