Пример #1
0
        public override void loadContent()
        {
            base.loadContent();
            if (!(Game.getInstance().getState() is DevelopmentState))
            {
                addHearts();
            }

            string[] t_heroSprites = Directory.GetFiles("Content//Images//Sprite//Hero//");
            foreach (string t_file in t_heroSprites)
            {
                string[] t_splitFile = Regex.Split(t_file, "//");
                string[] t_extless = t_splitFile[t_splitFile.Length - 1].Split('.');
                if (t_extless[1].Equals("xnb"))
                {
                    Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//" + t_extless[0]);
                }
            }

            m_img = new ImageManager("Images//Sprite//Hero//hero_stand");

            m_interactionArrow = new GameObject(new CartesianCoordinate(new Vector2(15, -70), m_position), "Images//GUI//GameGUI//interaction", m_layer - 0.1f, m_listLayer);
            setInteractionVisibility(false);
            m_interactionArrow.getImg().setAnimationSpeed(20f);
            m_standHitBox	= new CollisionRectangle(0, 0, 70, 127, m_position);
            m_rollHitBox	= new CollisionRectangle(0, 0, 70, 72, m_position);
            m_slideBox		= new CollisionRectangle(0, m_standHitBox.getOutBox().Height / 2, m_standHitBox.getOutBox().Width, 1, m_position);
            m_hangHitBox	= new CollisionRectangle(0, 0, 70, 80, m_position);
            m_swingHitBox	= new CollisionRectangle(-36, 0, 70, 127, m_position);
            m_collisionShape = m_standHitBox;
            m_ventilationDirection	= new List<Direction>();
            m_upDownList			= new List<Direction>();
            m_leftRightList			= new List<Direction>();
            m_noneList				= new List<Direction>();
            m_lastVentilationDirection = Direction.None;
            m_upDownList.Add(Direction.Up);
            m_upDownList.Add(Direction.Down);
            m_leftRightList.Add(Direction.Left);
            m_leftRightList.Add(Direction.Right);
            m_noneList.Add(Direction.None);
            m_playerCurrentSpeed = PLAYERSPEED;
            m_swingSpeed = 0;
            m_slideTimer = 0;
            m_currentVentilationImage = VENTIDLEIMAGE;
            m_currentSwingingImage = "hero_swing_still";
            m_position.plusYWith(-1);
            m_facingRight = true;

            m_hitSound1 = new Sound("Game//FirstHit");
            m_hitSound2 = new Sound("Game//SecHit");
            m_hitSound3 = new Sound("Game//LethalHit");
            m_jumpSound = new Sound("Game//hopp");
            m_landSound = new Sound("Game//landa2");
            m_landSound.setVolume(10);
            m_slideSound = new Sound("Game//32584__redjim__fabric-rustling");
            m_slideSound.setLooping(true);
            m_hangSound = new Sound("Game/ledgegrab");
            m_stepSound = new Sound("Game//walk");
            m_runSound = new Sound("Game//walk4");
            m_hideSound = new Sound("Game//hopp");
            m_ventilationMoveSound = new Sound("Game//ledgegrab");
            m_ladderSound = new Sound("Game//ledgegrab");
            m_rollSound = new Sound("Game//hopp");
            m_ledgeClimbSound = new Sound("Game//tygklatter");
            m_windowActionSound = new Sound("Game//tygklatter2");

            m_img.m_animationEvent += new ImageManager.animationDelegate(changedSubImage);
        }
Пример #2
0
 public override void loadContent()
 {
     base.loadContent();
     m_health = 3;
     m_healthHearts = new GuiObject[3];
     m_healthHearts[0] = new GuiObject(new Vector2(100, 50), "GameGUI//health");
     Game.getInstance().getState().addGuiObject(m_healthHearts[0]);
     m_healthHearts[1] = new GuiObject(new Vector2(200, 50), "GameGUI//health");
     Game.getInstance().getState().addGuiObject(m_healthHearts[1]);
     m_healthHearts[2] = new GuiObject(new Vector2(300, 50), "GameGUI//health");
     Game.getInstance().getState().addGuiObject(m_healthHearts[2]);
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_stand");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_walk");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_jump");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_fall");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_slide");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_hang");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_climb");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_roll");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_climb_ledge");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_window_heave");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_ventilation_idle");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_ventilation_vertical");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_ventilation_horizontal");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_swing_back");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_swing_still");
     Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Hero//hero_swing_forth");
     m_standHitBox = new CollisionRectangle(0, 0, 70, 127, m_position);
     m_rollHitBox = new CollisionRectangle(0, 0, 70, 72, m_position); // 67
     m_SlideBox = new CollisionRectangle(0, m_standHitBox.getOutBox().Height / 2, m_standHitBox.getOutBox().Width, 1, m_position);
     m_hangHitBox = new CollisionRectangle(0, 0, 70, 80, m_position);
     m_collisionShape = m_standHitBox;
     m_ventilationDirection = new List<Direction>();
     m_upDownList = new List<Direction>();
     m_upDownList.Add(Direction.Up);
     m_upDownList.Add(Direction.Down);
     m_leftRightList = new List<Direction>();
     m_leftRightList.Add(Direction.Left);
     m_leftRightList.Add(Direction.Right);
     m_playerCurrentSpeed = PLAYERSPEED;
     m_swingSpeed = 0;
     m_currentVentilationImage = VENTIDLEIMAGE;
     m_position.plusYWith(-1);
 }