Esempio n. 1
0
        public Sprite Spawn(TypeOfGameObject typeOfObject, Vector2 pos)
        {
            Sprite gameObject = InstanciateGameObject(typeOfObject, pos);

            if (gameObject != null)
            {
                GameObjectHandler.Instance.AddGameObject(gameObject);
            }
            else
            {
                //Error log?
            }

            return(gameObject);
        }
Esempio n. 2
0
        private Sprite InstanciateGameObject(TypeOfGameObject typeOfObject, Vector2 pos = default(Vector2))
        {
            Texture2D texture;

            switch (typeOfObject)
            {
            case TypeOfGameObject.AsteroidBig_64:
            {
                texture = GameReference.Content.Load <Texture2D>("Asteroid_64x64.png");
                return(new Asteroid(texture, pos));
            }

            case TypeOfGameObject.AsteroidBig_Explosion_64:
            {
                texture = GameReference.Content.Load <Texture2D>("Asteroid_Explosion_64x64.png");
                return(new Asteroid_Explosion(texture, pos));
            }

            case TypeOfGameObject.AsteroidBig1:
            {
                texture = GameReference.Content.Load <Texture2D>("meteorGrey_big1.png");
                return(new Asteroid(texture, pos));
            }

            case TypeOfGameObject.AsteroidBig2:
            {
                texture = GameReference.Content.Load <Texture2D>("meteorGrey_big2.png");
                return(new Asteroid(texture, pos));
            }

            case TypeOfGameObject.AsteroidMedium1:
            {
                texture = GameReference.Content.Load <Texture2D>("meteorGrey_med1.png");
                return(new Asteroid(texture, pos));
            }

            case TypeOfGameObject.AsteroidMedium2:
            {
                texture = GameReference.Content.Load <Texture2D>("meteorGrey_med2.png");
                return(new Asteroid(texture, pos));
            }

            case TypeOfGameObject.AsteroidSmall1:
            {
                texture = GameReference.Content.Load <Texture2D>("meteorGrey_small1.png");
                return(new Asteroid(texture, pos));
            }

            case TypeOfGameObject.AsteroidSmall2:
            {
                texture = GameReference.Content.Load <Texture2D>("meteorGrey_small2.png");
                return(new Asteroid(texture, pos));
            }

            case TypeOfGameObject.Bullet:
            {
                texture = GameReference.Content.Load <Texture2D>("Bullet_green.png");
                return(new Bullet(texture, pos));
            }

            case TypeOfGameObject.BulletRed:
            {
                texture = GameReference.Content.Load <Texture2D>("Bullet_red.png");
                return(new Bullet(texture, pos));
            }

            case TypeOfGameObject.Laser:
            {
                texture = GameReference.Content.Load <Texture2D>("Laser.png");
                return(new Laser(texture, pos));
            }

            case TypeOfGameObject.Robot:
            {
                texture = GameReference.Content.Load <Texture2D>("robot.png");
                return(new Robot(texture, pos));
            }

            case TypeOfGameObject.Rocket:
            {
                texture = GameReference.Content.Load <Texture2D>("Player_1_64x64.png");
                return(new Rocket(texture, pos));
            }

            case TypeOfGameObject.Ufo:
            {
                texture = GameReference.Content.Load <Texture2D>("UFO.png");
                return(new Ufo(texture, pos));
            }

            case TypeOfGameObject.UI:
            {
                texture = GameReference.Content.Load <Texture2D>("UI_1280x720.png");
                return(new UI(texture, pos));
            }

            case TypeOfGameObject.Healthbar:
            {
                texture = GameReference.Content.Load <Texture2D>("HealthFill.png");
                return(new Healthbar(texture, pos));
            }

            case TypeOfGameObject.Shieldbar:
            {
                texture = GameReference.Content.Load <Texture2D>("ShieldFill.png");
                return(new Shieldbar(texture, pos));
            }

            case TypeOfGameObject.Player_Explosion:
            {
                texture = GameReference.Content.Load <Texture2D>("Ship_Explosion_96x96.png");
                return(new Player_Explosion(texture, pos));
            }

            case TypeOfGameObject.Mine:
            {
                texture = GameReference.Content.Load <Texture2D>("Mine.png");
                return(new Mine(texture, pos));
            }

            case TypeOfGameObject.Missile:
            {
                texture = GameReference.Content.Load <Texture2D>("Missile.png");
                return(new Missile(texture, pos));
            }

            case TypeOfGameObject.EnemyShip:
            {
                texture = GameReference.Content.Load <Texture2D>("Enemy_2_64x64.png");
                return(new EnemyShip(texture, pos));
            }

            case TypeOfGameObject.EnemyBullet:
            {
                texture = GameReference.Content.Load <Texture2D>("bullet_red.png");
                return(new EnemyBullet(texture, pos));
            }

            case TypeOfGameObject.RocketHit:
            {
                texture = GameReference.Content.Load <Texture2D>("UFO3_64x64_HIT.png");
                return(new RocketHit(texture, pos));
            }

            case TypeOfGameObject.AutoLaserLost:
            {
                texture = GameReference.Content.Load <Texture2D>("AutoLaser_Lost.png");
                return(new AutoLaserLost(texture, pos));
            }

            case TypeOfGameObject.MissileLost:
            {
                texture = GameReference.Content.Load <Texture2D>("Missile_Lost.png");
                return(new MissileLost(texture, pos));
            }

            case TypeOfGameObject.ShieldRegenLost:
            {
                texture = GameReference.Content.Load <Texture2D>("ShieldRegen_Lost.png");
                return(new ShieldRegenLost(texture, pos));
            }

            case TypeOfGameObject.ShieldLost:
            {
                texture = GameReference.Content.Load <Texture2D>("Shield_Lost.png");
                return(new ShieldLost(texture, pos));
            }

            default:
            {
                return(null);
            }
            }
        }