public LightCone(GameObject a_parent, string a_sprite, float a_offset, float a_layer, float a_length, float a_width, float a_backLayer, string a_backSprite) : base((Position)new PolarCoordinate(a_offset, a_parent.getRotation(), a_parent.getPosition()), a_sprite, a_layer, a_parent.getRotation()) { if (a_length <= 0) { throw new ArgumentException("length has to be positive. was " + a_length); } if (a_width <= 0) { throw new ArgumentException("width has to be positive. was " + a_width); } m_length = a_length; m_width = a_width; m_XScale = a_length / m_img.getSize().X; m_YScale = a_width / m_img.getSize().Y; m_imgOffsetY = -m_rotationPoint.Y * m_YScale; m_backLayer = a_backLayer; if (a_backSprite != null) { m_backLightSprite = a_backSprite; m_backLight = new GameObject(new CartesianCoordinate(Vector2.Zero, m_position), m_backLightSprite, a_backLayer); m_backLight.getPosition().setLocalCartesian(-m_backLight.getImg().getSize() / 2f); } }
public static void copyAsset(Vector2 a_position, GameObject a_asset) { Vector2 t_position; if (a_position == null) { t_position = a_asset.getPosition().getGlobalCartesian(); } else { t_position = a_position; } string t_imagePath = a_asset.getImg().getImagePath(); if (a_asset is Player) { createPlayer(t_position); } if (a_asset is Platform) { if (a_asset is FlickeringSign) { createFlickringSign(t_position, t_imagePath); } createPlatform(t_position, t_imagePath); } if (a_asset is Ladder) { createLadder(t_position, t_imagePath); } if (a_asset is SpotLight) { createSpotLight(t_position, t_imagePath); } if (a_asset is Environment) { if (a_asset.getImg().getImagePath().StartsWith("Content//Images//Prop//")) { createProp(t_position, t_imagePath); } else if (a_asset is ParallaxEnvironment) { createParallax(t_position, t_imagePath); } else { createBackground(t_position, t_imagePath); } } if (a_asset is Guard) { createGuard(t_position, t_imagePath); } if (a_asset is Wall) { createWall(t_position, t_imagePath); } if (a_asset is DuckHideObject) { createDuckHideObject(t_position, t_imagePath); } if (a_asset is StandHideObject) { createStandHideObject(t_position, t_imagePath); } if (a_asset is GuardDog) { createGuardDog(t_position, t_imagePath); } if (a_asset is LampSwitch) { createLightSwitch(t_position, t_imagePath); } if (a_asset is CrossVentilation) { createCrossVent(t_position, t_imagePath); } if (a_asset is TVentilation) { createTVent(t_position, t_imagePath); } if (a_asset is StraightVentilation) { createStraightVent(t_position, t_imagePath); } if (a_asset is CornerVentilation) { createCornerVent(t_position, t_imagePath); } if (a_asset is VentilationDrum) { createVentrance(t_position, t_imagePath); } if (a_asset is Foreground) { createForeground(t_position, t_imagePath); } if (a_asset is Rope) { createRope(t_position); } if (a_asset is GuardCamera) { createCamera(t_position, t_imagePath); } if (a_asset is Window) { createWindow(t_position, t_imagePath); } if (a_asset is SecurityDoor) { createSecDoor(t_position, t_imagePath); } if (a_asset is CornerHang) { createCornerHang(t_position, t_imagePath); } if (a_asset is CheckPoint) { createCheckPoint(t_position); } if (a_asset is Consumable) { if (a_asset is ConsumableGoal) { createObjective(t_position, t_imagePath); } else if (a_asset is ConsumableKey) { createKey(t_position, t_imagePath); } else if (a_asset is ConsumableHeart) { createHeart(t_position, t_imagePath); } else { createConsumable(t_position, t_imagePath); } } if (a_asset is LockedDoor) { createClosedDoor(t_position, t_imagePath); } if (a_asset is CoveringShadow) { createCoveringShadow(t_position, t_imagePath); } if (a_asset is VentilationEnd) { createVentEnd(t_position, t_imagePath); } if (a_asset is LockedDoor) { createDoor(t_position, t_imagePath); } }
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); }
public override void loadContent() { base.loadContent(); m_collisionIsUpdated = false; m_rotationPoint.X = 0; m_rotationPoint.Y = m_img.getSize().Y / 2; m_imgOffsetY = -m_rotationPoint.Y*m_YScale; if (m_backLightSprite != null) { m_backLight = new GameObject(new CartesianCoordinate(Vector2.Zero, m_position), m_backLightSprite, m_backLayer, m_listLayer); m_backLight.getPosition().setLocalCartesian(-m_backLight.getImg().getSize() / 2f); } }