private Player.Player CreateAndRegisterPlayer()
        {
            Player.Player player = new Player.Player();
            player.TimerTickCallback = RegisterTimerTick;
            _registerComponent(player);

            return(player);
        }
        private Player.Player CreateAndRegisterPlayer()
        {
            Player.Player player = new Player.Player();
            player.TimerTickCallback = RegisterTimerTick;
            _registerComponent(player);

            return player;
        }
        public void StartPopupForEvent(Player.PlayerEvent playerEvent)
        {
            Visible = true;
            Scale = 0.0f;

            if (!string.IsNullOrEmpty(PopupTextureName(playerEvent)))
            {
                MappingName = PopupTextureName(playerEvent);
                Activate();
            }
        }
        private string PopupTextureName(Player.PlayerEvent playerEvent)
        {
            List<string> textureNames = new List<string>();
            string prefix = "";

            switch (playerEvent)
            {
                case Player.PlayerEvent.Died: prefix = "death"; break;
                case Player.PlayerEvent.Goal_Passed: prefix = "clear"; break;
            }

            return string.Concat("popup-", prefix, "-1");
        }
        public static Player.Player LoadPlayer(XElement playerData)
        {
            Player.Player player = Factory.CreateAndRegisterPlayer();
            player.CreateBonesFromDataManager(Definitions.Avatar_Skeleton_Side);
            player.SkinBones(AvatarComponentManager.SideFacingAvatarSkin(Profile.Settings.SelectedAvatarSlot));
            player.CustomSkinSlotIndex = Profile.Settings.SelectedAvatarSlot;

            player.WorldPosition =
                new Vector2((float)playerData.Attribute("x"), (float)playerData.Attribute("y")) +
                new Vector2(Definitions.Grid_Cell_Pixel_Size / 2.0f);
            player.Mirror = (bool)playerData.Attribute("startfacingleft");
            player.Activate();

            return(player);
        }
        public override void Activate()
        {
            FlushGameObjects();
            _animationController.FlushAnimatedObjects();
            GC.Collect();

            RegisterStaticGameObjects();

            _pauseController.Paused = false;
            _levelFactory.AnimationController = _animationController;
            _levelFactory.SmashBlockCallback = HandleSmashBlockSmash;
            _levelFactory.SmashBlockRegenerationCallback = _additiveParticleEffectManager.LaunchCloudBurst;
            _levelFactory.BombBlockDetonationCallback = _additiveParticleEffectManager.LaunchFireball;

            base.Activate();

            if (!RecoveredFromTombstone) { SetForNewLevelStart(); }
            else { HandleTombstoneRecoveryCompletion(); }

            _player = _levelFactory.Player;
            _player.PlayerEventCallback = HandlePlayerEvent;
            _player.InputProcessor = _inputProcessor;
            _player.CollisionController = _playerCollisionController;
            _player.DeathByFallingThreshold = _levelFactory.Map.MapWorldDimensions.Y;

            _cameraController.WorldDimensions = _levelFactory.Map.MapWorldDimensions;
            _cameraController.PlayerToTrack = _player;
            _cameraController.PositionForPlayStart();

            _playerCollisionController.ObjectToTest = _player;

            SetInterfaceDisplayObjectsForGame();
        }
 public void LaunchEnemyAttack(Player player)
 {
     Emitter effectEmitter = CreateEffectAtObjectPosition("attack-hit", "particle-cloud", player);
     effectEmitter.Tints = _attackHitColours;
     effectEmitter.Activate();
 }