Moved the ExoMech enumeration
This commit is contained in:
1 parent
6406df4244
commit
5134422860
5 files changed
+25
-23
No files matched your search
@@ -0,0 +1,10 @@
|
||||
namespace CalamityMod
|
||||
{
|
||||
public enum ExoMech
|
||||
{
|
||||
None,
|
||||
Destroyer,
|
||||
Prime,
|
||||
Twins
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,6 @@ namespace CalamityMod.NPCs.ExoMechs
|
||||
{
|
||||
public class Draedon : ModNPC
|
||||
{
|
||||
public enum ExoMech
|
||||
{
|
||||
None,
|
||||
Destroyer,
|
||||
Prime,
|
||||
Twins
|
||||
}
|
||||
|
||||
public Vector2 HoverDestinationOffset
|
||||
{
|
||||
get => new Vector2(npc.ai[1], npc.ai[2]);
|
||||
|
||||
+11
-11
@@ -31,12 +31,12 @@ namespace CalamityMod.UI
|
||||
Vector2 primeIconDrawOffset = new Vector2(0f, -140f);
|
||||
Vector2 twinsIconDrawOffset = new Vector2(78f, -124f);
|
||||
|
||||
HandleInteractionWithButton(baseDrawPosition + destroyerIconDrawOffset, Draedon.ExoMech.Destroyer);
|
||||
HandleInteractionWithButton(baseDrawPosition + primeIconDrawOffset, Draedon.ExoMech.Prime);
|
||||
HandleInteractionWithButton(baseDrawPosition + twinsIconDrawOffset, Draedon.ExoMech.Twins);
|
||||
HandleInteractionWithButton(baseDrawPosition + destroyerIconDrawOffset, ExoMech.Destroyer);
|
||||
HandleInteractionWithButton(baseDrawPosition + primeIconDrawOffset, ExoMech.Prime);
|
||||
HandleInteractionWithButton(baseDrawPosition + twinsIconDrawOffset, ExoMech.Twins);
|
||||
}
|
||||
|
||||
public static bool HandleInteractionWithButton(Vector2 drawPosition, Draedon.ExoMech exoMech)
|
||||
public static bool HandleInteractionWithButton(Vector2 drawPosition, ExoMech exoMech)
|
||||
{
|
||||
float iconScale;
|
||||
string description;
|
||||
@@ -44,18 +44,18 @@ namespace CalamityMod.UI
|
||||
|
||||
switch (exoMech)
|
||||
{
|
||||
case Draedon.ExoMech.Destroyer:
|
||||
case ExoMech.Destroyer:
|
||||
iconScale = DestroyerIconScale;
|
||||
iconMechTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/HeadIcon_THanos");
|
||||
description = "Thanatos, a serpentine terror with impervious armor and innumerable laser turrets.";
|
||||
break;
|
||||
case Draedon.ExoMech.Prime:
|
||||
case ExoMech.Prime:
|
||||
iconScale = PrimeIconScale;
|
||||
iconMechTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/HeadIcon_Ares");
|
||||
description = "Ares, a heavyweight, diabolical monstrosity with four Exo superweapons.";
|
||||
break;
|
||||
default:
|
||||
case Draedon.ExoMech.Twins:
|
||||
case ExoMech.Twins:
|
||||
iconScale = TwinsIconScale;
|
||||
iconMechTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/HeadIcon_ArtemisApollo");
|
||||
description = "Artemis and Apollo, a pair of extremely agile destroyers with pulse cannons.";
|
||||
@@ -63,7 +63,7 @@ namespace CalamityMod.UI
|
||||
}
|
||||
|
||||
// Check for mouse collision/clicks.
|
||||
Rectangle clickArea = Utils.CenteredRectangle(drawPosition, iconMechTexture.Size() * iconScale);
|
||||
Rectangle clickArea = Utils.CenteredRectangle(drawPosition, iconMechTexture.Size() * iconScale * 0.9f);
|
||||
|
||||
// Check if the mouse is hovering over the contact button area.
|
||||
bool hoveringOverIcon = MouseScreenArea.Intersects(clickArea);
|
||||
@@ -99,14 +99,14 @@ namespace CalamityMod.UI
|
||||
// And update to reflect the new scale.
|
||||
switch (exoMech)
|
||||
{
|
||||
case Draedon.ExoMech.Destroyer:
|
||||
case ExoMech.Destroyer:
|
||||
DestroyerIconScale = iconScale;
|
||||
break;
|
||||
case Draedon.ExoMech.Prime:
|
||||
case ExoMech.Prime:
|
||||
PrimeIconScale = iconScale;
|
||||
break;
|
||||
default:
|
||||
case Draedon.ExoMech.Twins:
|
||||
case ExoMech.Twins:
|
||||
TwinsIconScale = iconScale;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace CalamityMod.World
|
||||
|
||||
// Draedon Summoning stuff.
|
||||
public static int DraedonSummonCountdown = 0;
|
||||
public static Draedon.ExoMech DraedonMechToSummon;
|
||||
public static ExoMech DraedonMechToSummon;
|
||||
public static Vector2 DraedonSummonPosition = Vector2.Zero;
|
||||
public static bool AbleToSummonDraedon
|
||||
{
|
||||
@@ -1012,7 +1012,7 @@ namespace CalamityMod.World
|
||||
Reforges = reader.ReadInt32();
|
||||
MoneyStolenByBandit = reader.ReadInt32();
|
||||
DraedonSummonCountdown = reader.ReadInt32();
|
||||
DraedonMechToSummon = (Draedon.ExoMech)reader.ReadInt32();
|
||||
DraedonMechToSummon = (ExoMech)reader.ReadInt32();
|
||||
DraedonSummonPosition = reader.ReadVector2();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -39,9 +39,9 @@ namespace CalamityMod.World
|
||||
public static void PerformWorldUpdates()
|
||||
{
|
||||
// Reset the exo mech to summon if Draedon is absent.
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && DraedonMechToSummon != Draedon.ExoMech.None && CalamityGlobalNPC.draedon == -1)
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && DraedonMechToSummon != ExoMech.None && CalamityGlobalNPC.draedon == -1)
|
||||
{
|
||||
DraedonMechToSummon = Draedon.ExoMech.None;
|
||||
DraedonMechToSummon = ExoMech.None;
|
||||
CalamityNetcode.SyncWorld();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user