Ejemplo n.º 1
0
        public void Initialize(long id, NpcData proto, FixVector3 p, FixVector3 r)
        {
            this.id = id;

            type = LogicUnitType.NPC;

            position = p;

            transform.position = p.vector3;
            transform.rotation = Quaternion.Euler(r.vector3);

            brithPosition  = p;
            brithDirection = r;
            hurtType       = AttackPropertyType.PhysicalAttack;

            npcProto       = proto;
            iconId         = -1;
            metaId         = proto.ID;
            modelId        = proto.ModelID;
            modelRadius    = ConvertUtils.ToLogicInt(proto.ModelRadius);
            npcType        = (NpcType)proto.NPCType;
            attackType     = (NpcAttackType)proto.StandardAttack;
            rebornInterval = ConvertUtils.ToLogicInt(proto.RebornInterval);
            physicasAttack = (int)proto.PhysicsAttack;
            armor          = (int)proto.Armor;
            magicResist    = (int)proto.MagicResist;
            speedFactor    = ConvertUtils.ToLogicInt(proto.Speed);
            healthRegen    = proto.HealthRegen;

            maxHp            = proto.Health;
            chaseArea        = ConvertUtils.ToLogicInt(proto.TargetDetectRange);
            maxChaseDistance = ConvertUtils.ToLogicInt(proto.MaxChaseDistance);
            emberOutPut      = proto.EmberOutPut;
            projectileId     = proto.ProjectileId;
            attackRange      = ConvertUtils.ToLogicInt(proto.AttackRange);
            killReward       = proto.KillReward;
            attackDuration   = ConvertUtils.ToLogicInt(proto.AttackDuration);
            attackHitTime    = ConvertUtils.ToLogicInt(proto.AttackHitDuration);
            fightInterval    = 1;

            hp     = maxHp;
            damage = physicasAttack;
            healthRecoverInterval = GameConstants.HP_RECOVERY_INTERVAL_MILLISECOND;

            InitializeState();
            InitializePathAgent();

            debuffHandler = new DebuffHandler();
            buffHandler   = new BuffHandler();

            state      = NpcState.IDLE;
            currentFsm = fsmIdle;
        }
Ejemplo n.º 2
0
        public void Initialize(long id, NpcData proto, FixVector3 p, FixVector3 r)
        {
            this.id = id;

            type = LogicUnitType.Idol;

            position           = p;
            transform.position = p.vector3;
            brithPosition      = p;
            brithDirection     = r;
            hurtType           = AttackPropertyType.PhysicalAttack;

            npcProto         = proto;
            metaId           = proto.ID;
            iconId           = -1;
            modelId          = proto.ModelID;
            modelRadius      = ConvertUtils.ToLogicInt(proto.ModelRadius);
            npcType          = (NpcType)proto.NPCType;
            attackType       = (NpcAttackType)proto.StandardAttack;
            rebornInterval   = ConvertUtils.ToLogicInt(proto.RebornInterval);
            physicasAttack   = (int)proto.PhysicsAttack;
            armor            = (int)proto.Armor;
            magicResist      = (int)proto.MagicResist;
            speedFactor      = proto.Speed;
            healthRegen      = proto.HealthRegen;
            maxHp            = proto.Health;
            chaseArea        = proto.TargetDetectRange;
            maxChaseDistance = proto.MaxChaseDistance;
            emberOutPut      = proto.EmberOutPut;
            projectileId     = proto.ProjectileId;
            attackRange      = proto.AttackRange;
            killReward       = proto.KillReward;
            fightInterval    = 1;

            hp     = maxHp;
            damage = physicasAttack;

            InitializeState();

            state      = IdolState.IDLE;
            currentFsm = fsmIdle;
            ChangeState(IdolState.IDLE, fsmIdle);
        }