protected override void OnShow(object userData)
        {
            base.OnShow(userData);

            targetter.OnShow(userData);

            soundSerialId = GameEntry.Sound.PlaySound(EnumSound.TDEMPIdle, Entity);
        }
Ejemplo n.º 2
0
        protected override void OnShow(object userData)
        {
            base.OnShow(userData);
            AttackerData attackerData = AttackerData.Create(entityDataTower.Tower.Range,
                                                            entityDataTower.Tower.FireRate,
                                                            entityDataTower.Tower.IsMultiAttack,
                                                            entityDataTower.Tower.ProjectileType,
                                                            entityDataTower.Tower.ProjectileEntityId
                                                            );

            attacker.SetData(attackerData, entityDataTower.Tower.ProjectileData);

            targetter.OnShow(userData);
            attacker.OnShow(userData);
            attacker.SetOwnerEntity(Entity);
        }
        protected override void OnShow(object userData)
        {
            base.OnShow(userData);

            EntityDataEnemy = userData as EntityDataEnemy;

            if (EntityDataEnemy == null)
            {
                Log.Error("Entity enemy '{0}' entity data invaild.", Id);
                return;
            }

            hide          = false;
            Agent.enabled = true;
            LevelPath     = EntityDataEnemy.LevelPath;
            hp            = EntityDataEnemy.EnemyData.MaxHP;
            dataPlayer    = GameEntry.Data.GetData <DataPlayer>();

            Attacker.SetOwnerEntity(Entity);
            Targetter.SetAlignment(Alignment);
            Targetter.SetTurret(turret);
            Targetter.SetSearchRange(EntityDataEnemy.EnemyData.Range);
            Targetter.ResetTargetter();

            AttackerData attackerData = AttackerData.Create(EntityDataEnemy.EnemyData.Range,
                                                            EntityDataEnemy.EnemyData.FireRate,
                                                            EntityDataEnemy.EnemyData.IsMultiAttack,
                                                            EntityDataEnemy.EnemyData.ProjectileType,
                                                            EntityDataEnemy.EnemyData.ProjectileEntityId
                                                            );

            Attacker.SetData(attackerData, EntityDataEnemy.EnemyData.ProjectileData);
            Attacker.SetTargetter(Targetter);
            Attacker.SetProjectilePoints(projectilePoints);
            Attacker.SetEpicenter(epicenter);
            Attacker.SetLaunch(launcher);
            Attacker.ResetAttack();

            Targetter.OnShow(userData);
            Attacker.OnShow(userData);

            CreateFsm();
        }