示例#1
0
        public GameObject(InputComponent input, PhysicComponent physics, GraphicComponent graphics, SkillComponent skill)
        {
            _input    = input;
            _physics  = physics;
            _graphics = graphics;
            _skills   = skill;

            Position     = Vector2.Zero;
            Scale        = Vector2.One;
            Acceleration = Vector2.Zero;
            Velocity     = Vector2.Zero;
            Rotation     = 0f;
            IsActive     = true;
            Origin       = new Vector2(Viewport.Width / 2, Viewport.Height / 2);
        }
示例#2
0
        public void Init(ContentManager content)
        {
            this.content = content;


            _gameObjects = new List <GameObject>();
            enemyList    = new List <GameObject>();
            Singleton.Instance._camera    = new Camera();
            Singleton.Instance.Cooldown_1 = 0;
            Singleton.Instance.Cooldown_2 = 0;

            _bg    = content.Load <Texture2D>("sprites/stage_bg");
            _strip = content.Load <Texture2D>("sprites/menu_strip");
            _pin   = content.Load <Texture2D>("sprites/pin");
            _gauge = content.Load <Texture2D>("sprites/gauge");
            _arrow = content.Load <Texture2D>("sprites/arrow");
            _font  = content.Load <SpriteFont>("font/File");
            _hit   = content.Load <Texture2D>("sprites/hitbox");

            _guan = content.Load <Texture2D>("sprites/sheet_guan");
            _sung = content.Load <Texture2D>("sprites/sheet_sung");
            _mob  = content.Load <Texture2D>("sprites/sheet_mob");


            _selected = content.Load <SoundEffect>("sounds/selection_sound").CreateInstance();

            _selected.Volume = Singleton.Instance.MasterSFXVolume;


            cam = new GameObject(null, null, null, null)
            {
                Position = new Vector2(_bg.Width / 2, _bg.Height / 2),
            };

            SkillComponent skill   = null;
            String         _weapon = null;

            if (Singleton.Instance.CurrentHero == "zeus")
            {
                _player = content.Load <Texture2D>("sprites/sheet_zeus");
                _skill1 = content.Load <Texture2D>("sprites/skill_zeus_1");
                _skill2 = content.Load <Texture2D>("sprites/skill_zeus_2");
                skill   = new ZeusSkillComponent();
                _weapon = "thunder";
            }
            else if (Singleton.Instance.CurrentHero == "thor")
            {
                _player = content.Load <Texture2D>("sprites/sheet_thor");
                _skill1 = content.Load <Texture2D>("sprites/skill_thor_1");
                _skill2 = content.Load <Texture2D>("sprites/skill_thor_2");
                skill   = new ThorSkillComponent();
                _weapon = "hammer";
            }

            player = new GameObject(new CharacterInputComponent(content),
                                    new CharacterPhysicComponent(),
                                    new CharacterGraphicComponent(content, new Dictionary <string, Animation>()
            {
                { "Idle", new Animation(_player, new Rectangle(0, 0, 400, 250), 2) },
                { "Throw", new Animation(_player, new Rectangle(0, 250, 400, 250), 2) },
                { "Skill", new Animation(_player, new Rectangle(0, 500, 400, 250), 2) },
                { "Hit", new Animation(_player, new Rectangle(0, 750, 200, 250), 1) },
                { "Stunt", new Animation(_player, new Rectangle(0, 1000, 400, 250), 2) },
                { "Die", new Animation(_player, new Rectangle(200, 1250, 200, 250), 1) }
            }),
                                    skill)
            {
                Position = new Vector2(600, 800),
                InTurn   = true,
                Viewport = new Rectangle(0, 0, 150, 230),
                Name     = Singleton.Instance.CurrentHero,
                Weapon   = _weapon,
                HP       = 8,
                attack   = 1,
            };
            _gameObjects.Add(player);



            enemyIndex = 0;

            select   = false;
            IsPaused = false;

            Singleton.Instance.CurrentTurnState = Singleton.TurnState.skill;

            if (Singleton.Instance.CurrentStage == 1)
            {
                _sky      = content.Load <Texture2D>("sprites/stage_sky_1");
                _platform = content.Load <Texture2D>("sprites/stage_platform_1");
                SetStage1();
            }
            else if (Singleton.Instance.CurrentStage == 2)
            {
                _sky      = content.Load <Texture2D>("sprites/stage_sky_2");
                _platform = content.Load <Texture2D>("sprites/stage_platform_2");
                SetStage2();
            }
        }