public override void Dispose() { if (!IsDisposed) { m_teleporter = null; base.Dispose(); } }
public override void Dispose() { if (!base.IsDisposed) { this.m_teleporter = null; base.Dispose(); } }
public CastleEntranceRoomObj() { this.m_castleGate = new PhysicsObj("CastleEntranceGate_Sprite", null); this.m_castleGate.IsWeighted = false; this.m_castleGate.IsCollidable = true; this.m_castleGate.CollisionTypeTag = 1; this.m_castleGate.Layer = -1f; this.m_castleGate.OutlineWidth = 2; base.GameObjList.Add(this.m_castleGate); this.m_teleporter = new TeleporterObj(); base.GameObjList.Add(this.m_teleporter); }
public CastleEntranceRoomObj() { m_castleGate = new PhysicsObj("CastleEntranceGate_Sprite"); m_castleGate.IsWeighted = false; m_castleGate.IsCollidable = true; m_castleGate.CollisionTypeTag = 1; m_castleGate.Layer = -1f; m_castleGate.OutlineWidth = 2; GameObjList.Add(m_castleGate); m_teleporter = new TeleporterObj(); GameObjList.Add(m_teleporter); }
public override void Dispose() { if (!IsDisposed) { m_castleGate = null; m_teleporter = null; m_bossDoor = null; m_bossDoorSprite = null; m_diary = null; m_speechBubble = null; m_mapText = null; m_mapIcon = null; base.Dispose(); } }
public override void Initialize() { this.m_teleporter = new TeleporterObj(); SpriteObj item = null; foreach (GameObj current in base.GameObjList) { if (current.Name == "teleporter") { this.m_teleporter.Position = current.Position; item = (current as SpriteObj); break; } } base.GameObjList.Remove(item); base.GameObjList.Add(this.m_teleporter); this.m_teleporter.OutlineWidth = 2; this.m_teleporter.TextureColor = Color.PaleVioletRed; base.Initialize(); }
public override void Initialize() { m_teleporter = new TeleporterObj(); SpriteObj item = null; foreach (var current in GameObjList) { if (current.Name == "teleporter") { m_teleporter.Position = current.Position; item = (current as SpriteObj); break; } } GameObjList.Remove(item); GameObjList.Add(m_teleporter); m_teleporter.OutlineWidth = 2; m_teleporter.TextureColor = Color.PaleVioletRed; base.Initialize(); }
public override void Dispose() { if (!base.IsDisposed) { this.m_castleGate = null; this.m_teleporter = null; this.m_bossDoor = null; this.m_bossDoorSprite = null; this.m_diary = null; this.m_speechBubble = null; this.m_mapText = null; this.m_mapIcon = null; base.Dispose(); } }
public void TeleportPlayer(Vector2 position, TeleporterObj teleporter = null) { base.CurrentSpeed = 0f; this.Scale = this.m_internalScale; if (teleporter == null) { teleporter = this.m_lastTouchedTeleporter; } Console.WriteLine(string.Concat(new object[] { "Player pos: ", base.Position, " teleporter: ", teleporter.Position })); Tween.To(this, 0.4f, new Easing(Linear.EaseNone), new string[] { "X", teleporter.X.ToString() }); Tween.To(this, 0.05f, new Easing(Linear.EaseNone), new string[] { "delay", "1.5", "ScaleX", "0" }); Vector2 scale = this.Scale; this.ScaleX = 0f; Tween.To(this, 0.05f, new Easing(Linear.EaseNone), new string[] { "delay", "3.3", "ScaleX", scale.X.ToString() }); this.ScaleX = scale.X; Vector2 relativePos = new Vector2(position.X, position.Y - ((float)this.TerrainBounds.Bottom - base.Y)); LogicSet logicSet = new LogicSet(this); logicSet.AddAction(new RunFunctionLogicAction(this, "LockControls", new object[0]), Types.Sequence.Serial); logicSet.AddAction(new ChangeSpriteLogicAction("PlayerJumping_Character", true, true), Types.Sequence.Serial); logicSet.AddAction(new JumpLogicAction(500f), Types.Sequence.Serial); logicSet.AddAction(new PlaySoundLogicAction(new string[] { "Player_Jump_04" }), Types.Sequence.Serial); logicSet.AddAction(new RunFunctionLogicAction(teleporter, "SetCollision", new object[] { true }), Types.Sequence.Serial); logicSet.AddAction(new DelayLogicAction(0.4f, false), Types.Sequence.Serial); logicSet.AddAction(new GroundCheckLogicAction(), Types.Sequence.Serial); logicSet.AddAction(new ChangeSpriteLogicAction("PlayerLevelUp_Character", true, false), Types.Sequence.Parallel); logicSet.AddAction(new DelayLogicAction(0.1f, false), Types.Sequence.Serial); logicSet.AddAction(new RunFunctionLogicAction(this.AttachedLevel.ImpactEffectPool, "DisplayTeleportEffect", new object[] { new Vector2(teleporter.X, (float)teleporter.Bounds.Top) }), Types.Sequence.Serial); logicSet.AddAction(new DelayLogicAction(1f, false), Types.Sequence.Serial); logicSet.AddAction(new PlaySoundLogicAction(new string[] { "Teleport_Disappear" }), Types.Sequence.Serial); logicSet.AddAction(new RunFunctionLogicAction(this.AttachedLevel.ImpactEffectPool, "MegaTeleport", new object[] { new Vector2(teleporter.X, (float)teleporter.Bounds.Top), this.Scale }), Types.Sequence.Serial); logicSet.AddAction(new DelayLogicAction(0.8f, false), Types.Sequence.Serial); logicSet.AddAction(new RunFunctionLogicAction(this.m_levelScreen.ScreenManager, "StartWipeTransition", new object[0]), Types.Sequence.Serial); logicSet.AddAction(new DelayLogicAction(0.2f, false), Types.Sequence.Serial); logicSet.AddAction(new RunFunctionLogicAction(teleporter, "SetCollision", new object[] { false }), Types.Sequence.Serial); logicSet.AddAction(new TeleportLogicAction(null, relativePos), Types.Sequence.Serial); logicSet.AddAction(new DelayLogicAction(0.05f, false), Types.Sequence.Serial); logicSet.AddAction(new RunFunctionLogicAction(this.m_levelScreen.ScreenManager, "EndWipeTransition", new object[0]), Types.Sequence.Serial); logicSet.AddAction(new DelayLogicAction(0.5f, false), Types.Sequence.Serial); logicSet.AddAction(new RunFunctionLogicAction(this.AttachedLevel.ImpactEffectPool, "MegaTeleportReverse", new object[] { new Vector2(position.X - 5f, position.Y + 57f), scale }), Types.Sequence.Serial); logicSet.AddAction(new PlaySoundLogicAction(new string[] { "Teleport_Reappear" }), Types.Sequence.Serial); logicSet.AddAction(new DelayLogicAction(0.2f, false), Types.Sequence.Serial); logicSet.AddAction(new RunFunctionLogicAction(this, "LastBossDoorHack", new object[0]), Types.Sequence.Serial); this.RunExternalLogicSet(logicSet); }
public override void Dispose() { if (!base.IsDisposed) { if (this.m_currentLogicSet.IsActive) { this.m_currentLogicSet.Stop(); } this.m_currentLogicSet = null; this.m_standingAttack3LogicSet.Dispose(); this.m_standingAttack3LogicSet = null; this.m_airAttackLS.Dispose(); this.m_airAttackLS = null; this.m_debugInputMap.Dispose(); this.m_debugInputMap = null; this.m_playerHead = null; this.m_playerLegs = null; this.m_walkDownSound.Dispose(); this.m_walkDownSound = null; this.m_walkUpSound.Dispose(); this.m_walkUpSound = null; this.m_walkDownSoundLow.Dispose(); this.m_walkDownSoundLow = null; this.m_walkUpSoundLow.Dispose(); this.m_walkUpSoundLow = null; this.m_walkDownSoundHigh.Dispose(); this.m_walkDownSoundHigh = null; this.m_walkUpSoundHigh.Dispose(); this.m_walkUpSoundHigh = null; if (this.m_externalLS != null) { this.m_externalLS.Dispose(); } this.m_externalLS = null; this.m_lastTouchedTeleporter = null; this.m_flightDurationText.Dispose(); this.m_flightDurationText = null; this.m_game = null; this.m_translocatorSprite.Dispose(); this.m_translocatorSprite = null; this.m_swearBubble.Dispose(); this.m_swearBubble = null; this.m_flipTween = null; this.m_wizardSpellList.Clear(); this.m_wizardSpellList = null; this.m_closestGround = null; this.m_rapidDaggerProjData.Dispose(); this.m_axeProjData.Dispose(); base.Dispose(); } }
public override void CollisionResponse(CollisionBox thisBox, CollisionBox otherBox, int collisionResponseType) { IPhysicsObj physicsObj = otherBox.AbsParent as IPhysicsObj; TeleporterObj teleporterObj = otherBox.Parent as TeleporterObj; if (teleporterObj != null && !this.ControlsLocked && base.IsTouchingGround && (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17))) { this.StopAllSpells(); this.LockControls(); this.m_lastTouchedTeleporter = teleporterObj; Tween.RunFunction(0f, this.AttachedLevel, "DisplayMap", new object[] { true }); } DoorObj doorObj = otherBox.Parent as DoorObj; if (doorObj != null && !this.ControlsLocked && base.IsTouchingGround && doorObj.IsBossDoor && !doorObj.Locked && (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17))) { if (doorObj.Name == "FinalBossDoor") { Game.ScreenManager.DisplayScreen(24, true, null); } else { RoomObj linkedRoom = doorObj.Room.LinkedRoom; if (linkedRoom != null) { foreach (DoorObj current in linkedRoom.DoorList) { if (current.IsBossDoor) { if (linkedRoom is LastBossChallengeRoom) { linkedRoom.LinkedRoom = this.AttachedLevel.CurrentRoom; } this.StopAllSpells(); base.CurrentSpeed = 0f; this.LockControls(); (this.m_levelScreen.ScreenManager as RCScreenManager).StartWipeTransition(); Vector2 vector = new Vector2(current.X + (float)current.Width / 2f, (float)current.Bounds.Bottom - ((float)this.Bounds.Bottom - base.Y)); Tween.RunFunction(0.2f, this, "EnterBossRoom", new object[] { vector }); Tween.RunFunction(0.2f, this.m_levelScreen.ScreenManager, "EndWipeTransition", new object[0]); break; } } } } } BreakableObj breakableObj = physicsObj as BreakableObj; if (breakableObj != null && this.IsAirAttacking && thisBox.Type == 1) { this.IsAirAttacking = false; base.AccelerationY = -this.AirAttackKnockBack; this.NumAirBounces++; } if (Game.PlayerStats.Traits.X == 33f || Game.PlayerStats.Traits.Y == 33f) { if (breakableObj != null && !breakableObj.Broken) { breakableObj.Break(); } if (physicsObj.GetType() == typeof(PhysicsObj) && (physicsObj as PhysicsObj).SpriteName != "CastleEntranceGate_Sprite") { return; } } if (collisionResponseType == 1 && (physicsObj.CollisionTypeTag == 1 || physicsObj.CollisionTypeTag == 5 || physicsObj.CollisionTypeTag == 4 || physicsObj.CollisionTypeTag == 10)) { Vector2 vector2 = CollisionMath.CalculateMTD(thisBox.AbsRect, otherBox.AbsRect); float arg_325_0 = base.AccelerationY; Vector2 vector3 = CollisionMath.RotatedRectIntersectsMTD(thisBox.AbsRect, thisBox.AbsRotation, Vector2.Zero, otherBox.AbsRect, otherBox.AbsRotation, Vector2.Zero); bool flag = true; if (this.m_dropThroughGroundTimer > 0f && !physicsObj.CollidesBottom && physicsObj.CollidesTop) { flag = false; } if (this.m_isTouchingGround && !physicsObj.CollidesBottom && physicsObj.CollidesTop && physicsObj.TerrainBounds.Top < this.TerrainBounds.Bottom - 10) { flag = false; } if (!physicsObj.CollidesBottom && this.Bounds.Bottom > physicsObj.TerrainBounds.Top + 10 && !this.m_isTouchingGround) { flag = false; } if (!physicsObj.CollidesBottom && physicsObj.CollidesTop && (base.State == 7 || base.State == 9)) { flag = false; } if ((this.m_collidingLeftOnly || this.m_collidingRightOnly) && Math.Abs(vector2.X) < 10f && !this.m_isTouchingGround && !(physicsObj is HazardObj)) { flag = false; } if (!physicsObj.CollidesLeft && !physicsObj.CollidesRight && physicsObj.CollidesTop && physicsObj.CollidesBottom && !(physicsObj is HazardObj)) { if (Game.PlayerStats.Traits.X != 7f && Game.PlayerStats.Traits.Y != 7f) { if (base.X < (float)physicsObj.TerrainBounds.Center.X) { base.X -= (float)(this.TerrainBounds.Right - physicsObj.TerrainBounds.Left); } else { base.X += (float)(physicsObj.TerrainBounds.Right - this.TerrainBounds.Left); } } else { flag = false; } } if (this.m_isTouchingGround && this.m_closestGround == physicsObj) { flag = false; if (physicsObj is HazardObj && physicsObj.Rotation == -90f) { base.Y += (float)(this.m_closestGround.Bounds.Top - this.TerrainBounds.Bottom + 15); } else { base.Y += (float)(this.m_closestGround.TerrainBounds.Top - this.TerrainBounds.Bottom); } base.AccelerationY = 0f; } if (flag) { base.CollisionResponse(thisBox, otherBox, collisionResponseType); } if (vector3.Y != 0f && otherBox.AbsRotation != 0f) { base.X -= vector3.X; } } if (thisBox.Type == 2 && otherBox.Type == 1 && (physicsObj.CollisionTypeTag == 3 || physicsObj.CollisionTypeTag == 4 || physicsObj.CollisionTypeTag == 10) && base.State != 3 && this.m_invincibleCounter <= 0) { EnemyObj enemyObj = physicsObj as EnemyObj; if (enemyObj != null && enemyObj.IsDemented) { return; } ProjectileObj projectileObj = physicsObj as ProjectileObj; if (projectileObj != null && projectileObj.IsDemented) { return; } if (!LevelEV.ENABLE_PLAYER_DEBUG) { if (base.State == 6 && (this.CurrentMana > 0f || this.m_blockInvincibleCounter > 0f) && (projectileObj == null || (projectileObj != null && projectileObj.Spell != 8 && projectileObj.Spell != 12))) { if (base.CanBeKnockedBack) { Point center = Rectangle.Intersect(thisBox.AbsRect, otherBox.AbsRect).Center; Vector2 position = new Vector2((float)center.X, (float)center.Y); if (position == Vector2.Zero) { position = base.Position; } this.m_levelScreen.ImpactEffectPool.DisplayBlockImpactEffect(position, Vector2.One); base.CurrentSpeed = 0f; if ((float)(otherBox.AbsParent.Bounds.Left + otherBox.AbsParent.Bounds.Width / 2) > base.X) { base.AccelerationX = -base.KnockBack.X; } else { base.AccelerationX = base.KnockBack.X; } base.AccelerationY = -base.KnockBack.Y; base.Blink(Color.LightBlue, 0.1f); } if (this.m_blockInvincibleCounter <= 0f) { this.CurrentMana -= this.BlockManaDrain; this.m_blockInvincibleCounter = this.BlockInvincibleTime; this.m_levelScreen.TextManager.DisplayNumberStringText(-25, "mp", Color.SkyBlue, new Vector2(base.X, (float)this.Bounds.Top)); } SoundManager.PlaySound("Player_Block"); } else if (this.m_invincibleCounter <= 0) { this.HitPlayer(otherBox.AbsParent); } ProjectileObj projectileObj2 = otherBox.AbsParent as ProjectileObj; if (projectileObj2 != null && projectileObj2.DestroysWithEnemy && !this.m_assassinSpecialActive) { projectileObj2.RunDestroyAnimation(true); } } } ItemDropObj itemDropObj = physicsObj as ItemDropObj; if (itemDropObj != null && itemDropObj.IsCollectable) { itemDropObj.GiveReward(this, this.m_levelScreen.TextManager); itemDropObj.IsCollidable = false; itemDropObj.IsWeighted = false; itemDropObj.AnimationDelay = 0.0166666675f; itemDropObj.AccelerationY = 0f; itemDropObj.AccelerationX = 0f; Tween.By(itemDropObj, 0.4f, new Easing(Quad.EaseOut), new string[] { "Y", "-120" }); Tween.To(itemDropObj, 0.1f, new Easing(Linear.EaseNone), new string[] { "delay", "0.6", "Opacity", "0" }); Tween.AddEndHandlerToLastTween(this.m_levelScreen.ItemDropManager, "DestroyItemDrop", new object[] { itemDropObj }); SoundManager.PlaySound(new string[] { "CoinDrop1", "CoinDrop2", "CoinDrop3", "CoinDrop4", "CoinDrop5" }); } ChestObj chestObj = physicsObj as ChestObj; if (chestObj != null && !this.ControlsLocked && this.m_isTouchingGround && (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17)) && !chestObj.IsOpen) { chestObj.OpenChest(this.m_levelScreen.ItemDropManager, this); } }