Пример #1
0
 public override CollisionShape getHitBox()
 {
     if (m_lastCheckedHitBox != m_img.getSubImageIndex())
     {
         m_collisionShape = new CollisionRectangle(0, 0, m_img.getSize().X, m_img.getSize().Y - ((m_img.getSize().Y * m_img.getSubImageIndex()) / (float)m_img.getLength()), m_position);
         m_lastCheckedHitBox = m_img.getSubImageIndex();
     }
     return m_collisionShape;
 }
Пример #2
0
 public override void loadContent()
 {
     base.loadContent();
     m_startPosition = m_position;
     m_endPosition = new CartesianCoordinate(m_position.getGlobalCartesianCoordinates() + new Vector2(0, (float)Math.Max(m_lenght,72)));
     m_endPosition.setParentPositionWithoutMoving(m_startPosition);
     m_line = new Line(m_startPosition, m_endPosition, new Vector2(36, 0), new Vector2(36, 0), Color.Black, 5, true);
     m_collisionShape = new CollisionRectangle(33, 0, 6, m_lenght, m_startPosition);
     m_rotationPoint.Y = 0;
     m_rotate = (float)Math.PI / 2;
 }
Пример #3
0
 public override void loadContent()
 {
     base.loadContent();
     if (m_pairedVentilationId != 0 && m_pairedVentilation == null)
     {
         m_pairedVentilation = (VentilationDrum)Game.getInstance().getState().getObjectById(m_pairedVentilationId);
     }
     m_backImg = new ImageManager("Images//Tile//Ventilation//Straight//aventil_short_tile_w_floor");
     m_collisionShape = new CollisionRectangle(30, 30, 42, 12, m_position);
     if (s_unlockSound == null)
     {
         s_unlockSound = new Sound("Game//ledgegrab");
     }
 }
Пример #4
0
 public override void loadContent()
 {
     base.loadContent();
     if (0 == Math.Round(((2 * m_rotate) / Math.PI) % 4))
     {
         m_collisionShape = new CollisionRectangle(-3, -10, 6, 20, m_position);
     }
     else if (1 == Math.Round(((2 * m_rotate) / Math.PI) % 4))
     {
         m_collisionShape = new CollisionRectangle(-10, -3, 20, 6, m_position);
     }
     else if (2 == Math.Round(((2 * m_rotate) / Math.PI) % 4))
     {
         m_collisionShape = new CollisionRectangle(-3, -10, 6, 20, m_position);
     }
     else if (3 == Math.Round(((2 * m_rotate) / Math.PI) % 4))
     {
         m_collisionShape = new CollisionRectangle(-10, -3, 20, 6, m_position);
     }
 }
Пример #5
0
 public override void loadContent()
 {
     base.loadContent();
     m_connectedSpotLights = new LinkedList<SpotLight>();
     if (m_connectedSpotLightsId == null)
     {
         m_connectedSpotLightsId = new LinkedList<int>();
     }
     for (int i = 0; i < m_connectedSpotLightsId.Count(); i++)
     {
         try //TODO debug
         {
             m_connectedSpotLights.AddLast((SpotLight)Game.getInstance().getState().getObjectById(m_connectedSpotLightsId.ElementAt(i)));
         }
         catch (InvalidCastException)
         {
             m_connectedSpotLightsId.Remove(m_connectedSpotLightsId.ElementAt(i));
         }
     }
     m_collisionShape = new CollisionRectangle(28, 25, 45 - 28, 30, m_position);
     m_switchSound = new Sound("Game//lightbutton");
 }
Пример #6
0
 public override void loadContent()
 {
     base.loadContent();
     m_collisionShape = new CollisionRectangle(15, 30, m_img.getSize().X - 30, m_img.getSize().Y - 30, m_position);
     string[] t_heroSprites = Directory.GetFiles("Content//Images//Sprite//GuardDog//");
     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//GuardDog//" + t_extless[0]);
         }
     }
     m_dogBark = new Sound("Game//dog_bark");
 }
Пример #7
0
        public override void loadContent()
        {
            base.loadContent();
            if (m_lightLink > 0)
            {
                try
                {
                    m_light = (LightCone)Game.getInstance().getState().getObjectById(m_lightLink);
                }
                catch (InvalidCastException)
                {
                    (Game.getInstance().getState()).addObject(m_light = new LightCone(this, "Images//LightCone//Ljus", m_img.getSize().X, m_layer + 0.001f, 246f, 245f, m_layer - 0.01f, "Images//LightCone//ljusboll"));
                    m_lightLink = m_light.getId();
                }
            }
            if (m_light != null)
            {
                m_light.getPosition().setParentPosition(m_position);
            }

            m_imgOffsetY = -m_rotationPoint.Y * m_YScale;

            float t_halfHeight = m_img.getSize().Y / 2;
            float t_width = m_img.getSize().X;
            float t_cosRotate = (float)Math.Cos(m_rotate);
            float t_sinRotate = (float)Math.Sin(m_rotate);

            m_rotationPoint.Y = t_halfHeight;
            m_rotationPoint.X = 0;

            m_collisionShape = new CollisionRectangle((float)Math.Min(Math.Min(Math.Min(t_halfHeight * -t_sinRotate, t_halfHeight * t_sinRotate),
                t_halfHeight * -t_sinRotate + (t_width * t_cosRotate)),
                t_halfHeight * t_sinRotate + (t_width * t_cosRotate)),
                (float)Math.Min(Math.Min(Math.Min((t_halfHeight) * t_cosRotate,
                t_halfHeight * -t_cosRotate),
                t_halfHeight * t_cosRotate + (t_width * t_sinRotate)),
                t_halfHeight * -t_cosRotate + (t_width * t_sinRotate)),
                (float)(Math.Max(Math.Max(Math.Max((t_halfHeight) * -t_sinRotate, t_halfHeight * t_sinRotate),
                t_halfHeight * -t_sinRotate + (t_width * t_cosRotate)),
                t_halfHeight * t_sinRotate + (t_width * t_cosRotate)) -
                Math.Min(Math.Min(Math.Min((t_halfHeight) * -t_sinRotate, t_halfHeight * t_sinRotate),
                t_halfHeight * -t_sinRotate + (t_width * t_cosRotate)),
                t_halfHeight * t_sinRotate + (t_width * t_cosRotate))),
                (float)(Math.Max(Math.Max(Math.Max((t_halfHeight) * t_cosRotate,
                t_halfHeight * -t_cosRotate),
                t_halfHeight * t_cosRotate + (t_width * t_sinRotate)),
                t_halfHeight * -t_cosRotate + (t_width * t_sinRotate)) -
                (Math.Min(Math.Min(Math.Min((t_halfHeight) * t_cosRotate,
                t_halfHeight * -t_cosRotate),
                t_halfHeight * t_cosRotate + (t_width * t_sinRotate)),
                t_halfHeight * -t_cosRotate + (t_width * t_sinRotate)))),
                m_position);
        }
Пример #8
0
 public void load()
 {
     m_cameraBox = new CollisionRectangle(-Game.getInstance().getResolution().X, -Game.getInstance().getResolution().Y, Game.getInstance().getResolution().X * 2, Game.getInstance().getResolution().Y * 2, m_position);
 }
Пример #9
0
 public override void loadContent()
 {
     base.loadContent();
     m_collisionShape = new CollisionRectangle(15, 30, m_img.getSize().X - 30, m_img.getSize().Y - 30, m_position);
 }
Пример #10
0
 public override void loadContent()
 {
     base.loadContent();
     if (m_lightLink > 0)
     {
         m_light = (LightCone)Game.getInstance().getState().getObjectById(m_lightLink);
     }
     if(m_light != null)
     {
         m_light.getPosition().setParentPosition(m_position);
     }
     m_rotationPoint.Y = m_img.getSize().Y / 2;
     m_rotationPoint.X = 0;
     m_imgOffsetY = -m_rotationPoint.Y * m_YScale;
     m_collisionShape = new CollisionRectangle((float)Math.Min(Math.Min(Math.Min((m_img.getSize().Y / 2) * Math.Cos(0.5 * Math.PI + m_rotate), (m_img.getSize().Y / 2) * Math.Cos(1.5 * Math.PI + m_rotate)),
         (m_img.getSize().Y / 2) * Math.Cos(0.5 * Math.PI + m_rotate) + (m_img.getSize().X * Math.Cos(m_rotate))),
         (m_img.getSize().Y / 2) * Math.Cos(1.5 * Math.PI + m_rotate) + (m_img.getSize().X * Math.Cos(m_rotate))),
         (float)Math.Min(Math.Min(Math.Min((m_img.getSize().Y / 2) * Math.Sin(0.5 * Math.PI + m_rotate),
         (m_img.getSize().Y / 2) * Math.Sin(1.5 * Math.PI + m_rotate)),
         (m_img.getSize().Y / 2) * Math.Sin(0.5 * Math.PI + m_rotate) + (m_img.getSize().X * Math.Sin(m_rotate))),
         (m_img.getSize().Y / 2) * Math.Sin(1.5 * Math.PI + m_rotate) + (m_img.getSize().X * Math.Sin(m_rotate))),
         (float)(Math.Max(Math.Max(Math.Max((m_img.getSize().Y / 2) * Math.Cos(0.5 * Math.PI + m_rotate), (m_img.getSize().Y / 2) * Math.Cos(1.5 * Math.PI + m_rotate)),
         (m_img.getSize().Y / 2) * Math.Cos(0.5 * Math.PI + m_rotate) + (m_img.getSize().X * Math.Cos(m_rotate))),
         (m_img.getSize().Y / 2) * Math.Cos(1.5 * Math.PI + m_rotate) + (m_img.getSize().X * Math.Cos(m_rotate))) -
         Math.Min(Math.Min(Math.Min((m_img.getSize().Y / 2) * Math.Cos(0.5 * Math.PI + m_rotate), (m_img.getSize().Y / 2) * Math.Cos(1.5 * Math.PI + m_rotate)),
         (m_img.getSize().Y / 2) * Math.Cos(0.5 * Math.PI + m_rotate) + (m_img.getSize().X * Math.Cos(m_rotate))),
         (m_img.getSize().Y / 2) * Math.Cos(1.5 * Math.PI + m_rotate) + (m_img.getSize().X * Math.Cos(m_rotate)))),
         (float)(Math.Max(Math.Max(Math.Max((m_img.getSize().Y / 2) * Math.Sin(0.5 * Math.PI + m_rotate),
         (m_img.getSize().Y / 2) * Math.Sin(1.5 * Math.PI + m_rotate)),
         (m_img.getSize().Y / 2) * Math.Sin(0.5 * Math.PI + m_rotate) + (m_img.getSize().X * Math.Sin(m_rotate))),
         (m_img.getSize().Y / 2) * Math.Sin(1.5 * Math.PI + m_rotate) + (m_img.getSize().X * Math.Sin(m_rotate))) -
         (Math.Min(Math.Min(Math.Min((m_img.getSize().Y / 2) * Math.Sin(0.5 * Math.PI + m_rotate),
         (m_img.getSize().Y / 2) * Math.Sin(1.5 * Math.PI + m_rotate)),
         (m_img.getSize().Y / 2) * Math.Sin(0.5 * Math.PI + m_rotate) + (m_img.getSize().X * Math.Sin(m_rotate))),
         (m_img.getSize().Y / 2) * Math.Sin(1.5 * Math.PI + m_rotate) + (m_img.getSize().X * Math.Sin(m_rotate))))),
         m_position);
 }
Пример #11
0
        public override void loadContent()
        {
            base.loadContent();
            m_collisionShape = new CollisionRectangle(10, 10, m_img.getSize().X - 20, m_img.getSize().Y - 10, m_position);
            m_lampSwitchTargets = new LinkedList<LampSwitch>();
            if (m_flashLightId > 0)
            {
                m_flashLight = ((FlashCone)(Game.getInstance().getState().getObjectById(m_flashLightId)));
                m_flashLight.getPosition().setParentPosition(this.getPosition());
            }
            if (m_lampSwitchTargetsId == null)
            {
                m_lampSwitchTargetsId = new LinkedList<int>();
            }
            foreach (int t_lsti in m_lampSwitchTargetsId)
            {
                m_lampSwitchTargets.AddLast((LampSwitch)Game.getInstance().getState().getObjectById(t_lsti));
            }
            m_facingRight = m_spriteEffects == SpriteEffects.None;
            m_huhSound = new Sound("Game//104696__grunz__grunz-huh");
            m_huhSound.setVolume(7);

            #region Texture Loading
            t2d_run				= Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_run");
            t2d_walk			= Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_walk");
            t2d_flashWalk		= Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_flash_walk");
            t2d_flashIdle		= Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_flash_idle");
            t2d_flashTurn		= Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_flash_turn");
            t2d_idle			= Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_idle");
            t2d_pickUpFlash		= Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_pick_up_flash");
            t2d_putDownFlash	= Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_put_down_flash");
            t2d_strike			= Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_strike");
            t2d_turn			= Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_turn");
            t2d_qmark			= Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//qmark");
            t2d_emark			= Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//Exclmarks");
            #endregion
            if (m_img.isTexture(t2d_flashTurn) || m_img.isTexture(t2d_turn) || m_img.isTexture(t2d_pickUpFlash) || m_img.isTexture(t2d_putDownFlash))
            {
                m_img.setLooping(false);
            }
            if (m_img.isTexture(t2d_walk) || m_img.isTexture(t2d_flashWalk))
            {
                m_img.setAnimationSpeed(WALKINGANIMATIONSPEED);
            }
        }
Пример #12
0
 public override void loadContent()
 {
     base.loadContent();
     m_collisionShape = new CollisionRectangle(-3, -3, 6, 6, m_position);
 }
Пример #13
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);
        }
Пример #14
0
 public override void loadContent()
 {
     base.loadContent();
     m_collisionShape = new CollisionRectangle(m_img.getSize().X / 2 - 35, 0, 70, m_img.getSize().Y, m_position);
 }
Пример #15
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);
 }
Пример #16
0
        public override void loadContent()
        {
            base.loadContent();
            m_collisionShape = new CollisionRectangle(20, 10, m_img.getSize().X - 40, m_img.getSize().Y - 10, m_position);
            m_lampSwitchTargets = new LinkedList<LampSwitch>();
            if (m_lampSwitchTargetsId == null)
            {
                m_lampSwitchTargetsId = new LinkedList<int>();
            }
            foreach (int t_lsti in m_lampSwitchTargetsId)
            {
                m_lampSwitchTargets.AddLast((LampSwitch)Game.getInstance().getState().getObjectById(t_lsti));
            }
            if (m_flashLightId > 0)
            {
                m_flashLight = (FlashCone)Game.getInstance().getState().getObjectById(m_flashLightId);
                m_flashLight.getPosition().setParentPosition(m_position);
            }
            m_facingRight = m_spriteEffects == SpriteEffects.None;

            Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_run");
            Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_walk");
            Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_flash_walk");
            Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_flash_idle");
            Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_flash_turn");
            Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_idle");
            Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_pick_up_flash");
            Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_put_down_flash");
            Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_strike");
            Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//guard_turn");
            Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//qmark");
            Game.getInstance().Content.Load<Texture2D>("Images//Sprite//Guard//Exclmarks");
        }