public PlayerCollision(PlayerActor a_Actor)
        {
            m_Actor = a_Actor;
            m_Actor.OldPosition = m_Actor.Position;

            m_CheckMaxDisplacement = 25;
            m_UpdateMaxDisplacement = 25;

            UpdateCollision();
        }
예제 #2
0
        protected override void Initialize()
        {
            Input.Initiailize();

            m_IsGameStarted = false;

            m_Effect = new BasicEffect(GraphicsDevice);
            m_Effect.EnableDefaultLighting();

            m_SpriteBatch = new SpriteBatch(GraphicsDevice);
            m_SplashScreen = Content.Load<Texture2D>("Screen/SplashScreen");

            File.ContentManager = Content;
            ScoreManager.SpriteFont = Content.Load<SpriteFont>("Font/ScoreMain");
            EmitterManager.Sprite = Content.Load<Texture2D>("Pixel");
            Audio.Song = Content.Load<Song>("Audio/Song");

            #if !WINDOWS
            List<Data.BaseActor> tempList = Content.Load<List<Data.BaseActor>>("Level/1");

            Vector2 playerPosition = Vector2.Zero;

            for (int loop = 0; loop < tempList.Count; loop++)
            {
                if (tempList[loop] is Data.TileActor)
                {
                    ActorManager.List.Add(new TileActor(tempList[loop].FilePathToTexture, tempList[loop].Position, tempList[loop].IsCollidable, tempList[loop].IsDestructable));
                }

                if (tempList[loop] is Data.BallActor)
                {
                    Data.BallActor temp = (Data.BallActor)tempList[loop];
                    ActorManager.List.Add(new BallActor(temp.Position, (int)temp.BallType));
                }

            if (tempList[loop] is Data.TurretActor)
                    {
                        Data.TurretActor temp = (Data.TurretActor)tempList[loop];
                        ActorManager.List.Add(new TurretActor(temp.Position, (int)temp.TurretType));
                    }

                if (tempList[loop] is Data.AreaActor)
                {
                    Data.AreaActor temp = (Data.AreaActor)tempList[loop];
                    ActorManager.List.Add(new AreaActor(temp.Position, (int)temp.AreaType));

                    if (temp.AreaType == Data.AreaType.Start)
                    {
                        playerPosition = temp.Position;
                    }
                }
            }
            PlayerActor player = new PlayerActor("Sprite/Tank_Base", playerPosition);
            ActorManager.List.Add(player);
            File.Player = player;
            #endif

            base.Initialize();
        }