Exemplo n.º 1
0
 public virtual void InitializeData(SummonProto proto)
 {
     attackDuration    = ConvertUtils.ToLogicInt(proto.Attack_duration);
     attackHitTime     = ConvertUtils.ToLogicInt(proto.Attack_hit_time);
     attackRadius      = ConvertUtils.ToLogicInt(proto.Attack_radius);
     summonType        = proto.Summon_type;
     attackInterval    = ConvertUtils.ToLogicInt(proto.Attack_interval);
     physicalAttack    = (int)proto.Physical_attack;
     physicalAttackVar = (int)(proto.Physical_attack_var);
     brithDuration     = ConvertUtils.ToLogicInt(proto.Brith_duration);
 }
Exemplo n.º 2
0
        public void Initialized(int metaId)
        {
            SummonProto proto = DataManager.GetInstance().summonProtoData.Find(p => p.ID == metaId);

            DebugUtils.Assert(proto != null, string.Format("Can't find metaId = {0} in summon table", metaId));

            attackEffectResId     = proto.Attack_res;
            attackEffectBindpoint = proto.Attack_res_bindpoint;
            deathEffectResId      = proto.Death_res_id;
            deathEffectBindpoint  = proto.Death_res_bindpoint;

            gameObject.SetActive(true);
        }
Exemplo n.º 3
0
        public virtual void Initialize(Skill owner, long id, SummonProto proto, FixVector3 pos, FixVector3 rotation)
        {
            type = LogicUnitType.Summon;

            this.id                 = id;
            this.position           = pos;
            this.direction          = rotation;
            this.metaId             = proto.ID;
            this.mark               = owner.mark;
            this.ownerSKill         = owner;
            this.ownerSoldier       = owner.owner;
            this.transform.position = position.vector3;

            transform.name = string.Format("Summon_{0}", id);

            // Init data
            InitializeData(proto);

            // Init fsm
            InitializeFsm();

            DebugUtils.Log(DebugUtils.Type.AI_Summon, string.Format("Summon has been initialize id = {0}", id));
        }
Exemplo n.º 4
0
        public void ReleaseSkill(int index, int skillMetaId, Vector3 position)
        {
            SkillProto proto = DataManager.GetInstance().unitSkillsProtoData.Find(p => p.ID == skillMetaId);

            // TODO: Wait new data struct
            int carrierType = proto.CarrierType;

            int    fireEffectId = 0;
            string bindPoint    = string.Empty;

            if (proto.CarrierID <= 0)
            {
                fireEffectId = proto.SkillEffectID;
                bindPoint    = proto.skill_effect_bindpoint;
                PlayEffect(fireEffectId, bindPoint);
            }
            else
            {
                int carrierId = proto.CarrierID;

                // 1 projectile
                if (carrierType == 1)
                {
                    ProjectileProto projectileProto = null;

                    if (unitProjectiles.ContainsKey(carrierId))
                    {
                        projectileProto = unitProjectiles[carrierId];
                    }
                    else
                    {
                        projectileProto = DataManager.GetInstance().projectileProtoData.Find(p => p.ID == carrierId);
                        unitProjectiles.Add(carrierId, projectileProto);
                    }

                    if (projectileProto != null)
                    {
                        fireEffectId = projectileProto.FireEffect_ResourceId;
                        bindPoint    = projectileProto.fire_res_bindpoint;

                        PlayEffect(fireEffectId, bindPoint);
                    }
                }
                else if (carrierType == 2)
                {
                    // trap
                }
                else if (carrierType == 3)
                {
                    SummonProto summonProto = null;

                    if (summonProtos.ContainsKey(carrierId))
                    {
                        summonProto = summonProtos[carrierId];
                    }
                    else
                    {
                        summonProto = DataManager.GetInstance().summonProtoData.Find(p => p.ID == carrierId);
                        summonProtos.Add(carrierId, summonProto);
                    }

                    if (summonProto != null)
                    {
                        // summon
                        fireEffectId = summonProto.Born_effect_id;
                        PlayEffect(fireEffectId, position);
                    }
                }
            }

            if (index == 1)
            {
                PlayAnimation(TRIGGER_SKILL1, 1);
            }
            else if (index == 2)
            {
                PlayAnimation(TRIGGER_SKILL2, 1);
            }
            else
            {
                DebugUtils.Assert(false, "Can't handle this skill index in soldier render, index = " + index);
            }
        }