示例#1
0
 public LeachImpact(string damageType, string targetVital, float damagePercent, ActionFx actionFx)
 {
     _damageType    = damageType;
     _targetVital   = targetVital;
     _damagePercent = damagePercent;
     _actionFx      = actionFx;
 }
示例#2
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;
        }
示例#3
0
 public Action(SerializationInfo info, StreamingContext context)
 {
     Sequence     = info.GetValue(nameof(Sequence), Sequence);
     Costs        = info.GetValue(nameof(Costs), Costs);
     Range        = info.GetValue(nameof(Range), Range);
     WeaponModel  = info.GetValue(nameof(WeaponModel), WeaponModel);
     Primary      = info.GetValue(nameof(Primary), Primary);
     EquippedSlot = info.GetValue(nameof(EquippedSlot), EquippedSlot);
     _ammo        = info.GetValue(nameof(_ammo), _ammo);
     Fx           = ItemPool.LoadAsset <ActionFx>(info.GetValue(nameof(Fx), ""));
 }
示例#4
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;
            }
        public static void SpawnProjectile(Entity owner, string id, Vector3 target, Vector3 spawnPos, Quaternion spawnRot, ActionFx
                                           actionFx = null)
        {
            if (_configs.Count == 0)
            {
                Init();
            }
            if (!_configs.TryGetValue(id, out var config))
            {
#if DEBUG
                DebugLog.Add("Couldn't find project config " + id, false);
#endif
                return;
            }
            SpawnProjectile(owner, config, target, spawnPos, spawnRot, actionFx);
        }
        public static void SpawnProjectile(Entity owner, ProjectileConfig config, Vector3 target, Vector3 spawnPos, Quaternion spawnRot, ActionFx actionFx = null)
        {
            var entity = Main.GetProjectile(config);

            entity.ParentId = owner.Id;
            var projectileEvent = _loadPool.New();

            if (config.Type == ProjectileType.SpriteAnimation)
            {
                config.Animation.LoadAsset();
            }
            projectileEvent.Set(config, entity, target, spawnPos, spawnRot, actionFx);
            ItemPool.Spawn(projectileEvent);
        }
示例#7
0
 public void ChangeFx(ActionFx fx)
 {
     Fx = fx;
 }
示例#8
0
 public ActionFxComponent(SerializationInfo info, StreamingContext context)
 {
     Fx = ItemPool.LoadAsset <ActionFx>(info.GetValue(nameof(Fx), ""));
 }
示例#9
0
 public ActionFxComponent(ActionFx fx)
 {
     Fx = fx;
 }
示例#10
0
 public ActionFxData(ActionFx fx)
 {
     Fx = fx;
 }
示例#11
0
 private void TriggerCollisionEvent(ActionFx data, Vector3 hitPoint, Vector3 hitNormal, Entity target)
 {
     data.TriggerEvent(
         ActionState.Collision, hitPoint + (hitNormal * 0.1f), Quaternion.LookRotation(hitNormal),
         target?.GetTemplate <CharacterTemplate>());
 }
示例#12
0
 public void ChangeFx(ActionFx fx)
 {
     Value = fx;
 }
示例#13
0
 public ActionFxComponent(SerializationInfo info, StreamingContext context)
 {
     ItemPool.LoadAsset <ActionFx>(info.GetValue(nameof(Value), ""), a => Value = a);
 }
示例#14
0
 public ActionFxComponent(ActionFx fx)
 {
     Value = fx;
 }