public EnemyObj_LastBoss(PlayerObj target, PhysicsManager physicsManager, ProceduralLevelScreen levelToAttachTo, GameTypes.EnemyDifficulty difficulty) : base("PlayerIdle_Character", target, physicsManager, levelToAttachTo, difficulty) { foreach (GameObj current in this._objectList) { current.TextureColor = new Color(100, 100, 100); } this.Type = 29; this.m_damageShieldProjectiles = new List<ProjectileObj>(); this._objectList[5].Visible = false; this._objectList[15].Visible = false; this._objectList[16].Visible = false; this._objectList[14].Visible = false; this._objectList[13].Visible = false; this._objectList[0].Visible = false; string text = (this._objectList[12] as IAnimateableObj).SpriteName; int startIndex = text.IndexOf("_") - 1; text = text.Remove(startIndex, 1); text = text.Replace("_", 7 + "_"); this._objectList[12].ChangeSprite(text); base.PlayAnimation(true); this.m_delayObj = new BlankObj(0, 0); this.m_walkDownSoundFinalBoss = new FrameSoundObj(this, 3, new string[] { "FinalBoss_St2_Foot_01", "FinalBoss_St2_Foot_02", "FinalBoss_St2_Foot_03" }); this.m_walkUpSoundFinalBoss = new FrameSoundObj(this, 6, new string[] { "FinalBoss_St2_Foot_04", "FinalBoss_St2_Foot_05" }); }
public static void RunTeleport(ProjectileObj proj) { var source = proj.Source as PhysicsObjContainer; int closestDistance = int.MaxValue; BlankObj closestObj = null; bool flip = source.Flip != SpriteEffects.None; foreach (BlankObj terrainObj in Core.GetCurrentRoomTerrainObjects()) { if (terrainObj.Bounds.Top >= proj.Bounds.Bottom || terrainObj.Bounds.Bottom <= proj.Bounds.Top) { continue; } var point = Vector2.Zero; float distance = float.MaxValue; Vector2 start1 = Vector2.Zero, end1 = Vector2.Zero; Func <Rectangle, float, Vector2, Vector2> startFunc = null, endFunc = null; if (!flip) { if (terrainObj.X <= proj.X) { continue; } if (terrainObj.Rotation != 0) { start1 = proj.Position; end1 = new Vector2(proj.X + 6600f, proj.Y); if (terrainObj.Rotation < 0f) { startFunc = CollisionMath.UpperLeftCorner; endFunc = CollisionMath.UpperRightCorner; } else { startFunc = CollisionMath.LowerLeftCorner; endFunc = CollisionMath.UpperLeftCorner; } } } else { if (terrainObj.X >= proj.X) { continue; } if (terrainObj.Rotation != 0) { start1 = new Vector2(proj.X - 6600f, proj.Y); end1 = proj.Position; if (terrainObj.Rotation < 0f) { startFunc = CollisionMath.UpperRightCorner; endFunc = CollisionMath.LowerRightCorner; } else { startFunc = CollisionMath.UpperLeftCorner; endFunc = CollisionMath.UpperRightCorner; } } } if (startFunc != null) { var bounds = new Rectangle((int)terrainObj.X, (int)terrainObj.Y, terrainObj.Width, terrainObj.Height); var start2 = startFunc(bounds, terrainObj.Rotation, Vector2.Zero); var end2 = endFunc(bounds, terrainObj.Rotation, Vector2.Zero); point = CollisionMath.LineToLineIntersect(start1, end1, start2, end2); } if (point == Vector2.Zero) { distance = !flip ? (terrainObj.Bounds.Left - proj.Bounds.Right) : (proj.Bounds.Left - terrainObj.Bounds.Right); } else { distance = !flip ? (point.X - proj.X) : (proj.X - point.X); } if (distance < closestDistance) { closestDistance = (int)distance; closestObj = terrainObj; } } if (closestObj != null) { var newOffset = closestDistance - (closestObj.Rotation != 0f ? source.Width : source.TerrainBounds.Width) / 2f; if (flip) { newOffset = -newOffset; } source.X += newOffset; } }
public override void Dispose() { if (!base.IsDisposed) { this.m_damageShieldProjectiles.Clear(); this.m_damageShieldProjectiles = null; this.m_delayObj.Dispose(); this.m_delayObj = null; if (this.m_daggerProjData != null) { this.m_daggerProjData.Dispose(); this.m_daggerProjData = null; } if (this.m_axeProjData != null) { this.m_axeProjData.Dispose(); this.m_axeProjData = null; } base.Dispose(); } }