コード例 #1
0
            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;
            }
コード例 #2
0
ファイル: EventNode.cs プロジェクト: FuzzySlipper/Framework
 public override void OnEnter(RuntimeStateNode lastNode)
 {
     base.OnEnter(lastNode);
     if (!_originalNode.Loop)
     {
         Graph.Entity.Post(new AnimationEventTriggered(Graph.Entity, _originalNode.EventName));
     }
 }
コード例 #3
0
 public override void OnEnter(RuntimeStateNode lastNode)
 {
     base.OnEnter(lastNode);
     if (_component == null)
     {
         _component = Graph.Entity.Get <WeaponBobComponent>();
     }
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 public override void OnEnter(RuntimeStateNode lastNode)
 {
     base.OnEnter(lastNode);
     if (_poseAnimator == null)
     {
         _poseAnimator = Graph.Entity.Get <PoseAnimatorComponent>();
     }
     Setup();
 }
コード例 #6
0
 public override void OnEnter(RuntimeStateNode lastNode)
 {
     base.OnEnter(lastNode);
     _component = Graph.Entity.Get <FpPivotComponent>();
     if (_component != null)
     {
         _origin = _component.Tr.localPosition;
     }
     _time = 0;
 }
コード例 #7
0
 public override void OnEnter(RuntimeStateNode lastNode)
 {
     base.OnEnter(lastNode);
     if (!_setup)
     {
         _animNode.Animation.LoadAsset(FinishSetup);
     }
     else
     {
         SetupAnimation();
     }
 }
コード例 #8
0
 public override void OnEnter(RuntimeStateNode lastNode)
 {
     base.OnEnter(lastNode);
     if (!_setup)
     {
         _spriteNode.Sprite.LoadAsset(FinishSetup);
     }
     else
     {
         SetSprite();
     }
 }
コード例 #9
0
 public override void OnEnter(RuntimeStateNode lastNode)
 {
     base.OnEnter(lastNode);
     if (!_setup)
     {
         var op = _spriteNode.Sprite.LoadAssetAsync <SpriteAnimation>();
         op.Completed += FinishSetup;
     }
     else
     {
         SetSprite();
     }
 }
コード例 #10
0
 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;
 }
コード例 #11
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);
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
 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;
 }
コード例 #16
0
            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();
            }
コード例 #17
0
            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;
            }
コード例 #18
0
        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);
        }
コード例 #19
0
        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);
        }
コード例 #20
0
 public abstract bool IsTrue(RuntimeStateNode node);
コード例 #21
0
 public override void OnEnter(RuntimeStateNode lastNode)
 {
     base.OnEnter(lastNode);
     _sequence.Play();
 }
コード例 #22
0
 public RuntimeNode(DummyStateNode node, RuntimeStateGraph graph) : base(node, graph)
 {
     _exitNode = GetOriginalNodeExit();
     _timer    = new UnscaledTimer(node._timer);
 }
コード例 #23
0
 public override void OnEnter(RuntimeStateNode lastNode)
 {
     base.OnEnter(lastNode);
     _completed = false;
     ExternalGraph.Start();
 }
コード例 #24
0
 public override void OnEnter(RuntimeStateNode lastNode)
 {
     base.OnEnter(lastNode);
     Graph.GraphCompleted();
 }
コード例 #25
0
 public override void OnEnter(RuntimeStateNode lastNode)
 {
     base.OnEnter(lastNode);
     _input = Graph.Entity.Get <PlayerInputComponent>();
 }
コード例 #26
0
 public override void OnEnter(RuntimeStateNode lastNode)
 {
     base.OnEnter(lastNode);
 }
コード例 #27
0
 public void ChangeNode(RuntimeStateNode node)
 {
     SetCurrentNode(node);
 }