Esempio n. 1
0
        public override void Start(ActionUsingNode node)
        {
            base.Start(node);
            var model = ItemPool.Spawn(UnityDirs.Models, ModelData, Vector3.zero, Quaternion.identity);

            if (model != null)
            {
                node.ParentSpawn(model.Transform);
                node.ActionEvent.Action.Entity.Add(new RenderingComponent(model.GetComponent <IRenderingComponent>()));
                node.ActionEvent.Action.Entity.Add(new TransformComponent(model.transform));
            }
            var dmgComponent = node.Entity.GetOrAdd <BlockDamage>();

            if (!node.Entity.Tags.Contain(EntityTags.Player))
            {
                dmgComponent.DamageBlockers.Add(BlockDamageFlat);
                _isWaiting = true;
                _vitalStat = null;
                return;
            }
            _vitalStat = node.Stats.GetVital(TargetVital);
            var skillMulti = 1f;

            if (!string.IsNullOrEmpty(_skill))
            {
                var skillValue = node.Entity.FindStatValue(_skill);
                skillMulti = Mathf.Clamp(1 - (skillValue * CostVital.SkillPercent), CostVital.SkillMaxReduction, 1);
            }
            dmgComponent.CollisionHandlers.Add(EvadeDamageWithStats);
            _fxComponent = node.ActionEvent.Action.Fx;
            _finalCost   = Cost * skillMulti;
        }
Esempio n. 2
0
        public void Trigger(ActionUsingNode node, string eventName)
        {
            var model = ItemPool.Spawn(UnityDirs.Models, Data, Vector3.zero, Quaternion.identity);

            if (model != null)
            {
                node.ParentSpawn(model.Transform);
                node.ActionEvent.Action.Entity.Add(new RenderingComponent(model.GetComponent <IRenderingComponent>()));
            }
        }