diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index 3460cd8..33fcb2f 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -137,54 +137,54 @@ #begin Textures/Animations/player_left_idle.animation /copy:Textures/Animations/player_left_idle.animation -#begin Textures/Animations/player_look_down.animation -/copy:Textures/Animations/player_look_down.animation - #begin Textures/Animations/player_look_down_weapon.animation /copy:Textures/Animations/player_look_down_weapon.animation -#begin Textures/Animations/player_look_left.animation -/copy:Textures/Animations/player_look_left.animation - -#begin Textures/Animations/player_look_left_down.animation -/copy:Textures/Animations/player_look_left_down.animation +#begin Textures/Animations/player_look_down.animation +/copy:Textures/Animations/player_look_down.animation #begin Textures/Animations/player_look_left_down_weapon.animation /copy:Textures/Animations/player_look_left_down_weapon.animation -#begin Textures/Animations/player_look_left_up.animation -/copy:Textures/Animations/player_look_left_up.animation +#begin Textures/Animations/player_look_left_down.animation +/copy:Textures/Animations/player_look_left_down.animation #begin Textures/Animations/player_look_left_up_weapon.animation /copy:Textures/Animations/player_look_left_up_weapon.animation +#begin Textures/Animations/player_look_left_up.animation +/copy:Textures/Animations/player_look_left_up.animation + #begin Textures/Animations/player_look_left_weapon.animation /copy:Textures/Animations/player_look_left_weapon.animation -#begin Textures/Animations/player_look_right.animation -/copy:Textures/Animations/player_look_right.animation - -#begin Textures/Animations/player_look_right_down.animation -/copy:Textures/Animations/player_look_right_down.animation +#begin Textures/Animations/player_look_left.animation +/copy:Textures/Animations/player_look_left.animation #begin Textures/Animations/player_look_right_down_weapon.animation /copy:Textures/Animations/player_look_right_down_weapon.animation -#begin Textures/Animations/player_look_right_up.animation -/copy:Textures/Animations/player_look_right_up.animation +#begin Textures/Animations/player_look_right_down.animation +/copy:Textures/Animations/player_look_right_down.animation #begin Textures/Animations/player_look_right_up_weapon.animation /copy:Textures/Animations/player_look_right_up_weapon.animation +#begin Textures/Animations/player_look_right_up.animation +/copy:Textures/Animations/player_look_right_up.animation + #begin Textures/Animations/player_look_right_weapon.animation /copy:Textures/Animations/player_look_right_weapon.animation -#begin Textures/Animations/player_look_up.animation -/copy:Textures/Animations/player_look_up.animation +#begin Textures/Animations/player_look_right.animation +/copy:Textures/Animations/player_look_right.animation #begin Textures/Animations/player_look_up_weapon.animation /copy:Textures/Animations/player_look_up_weapon.animation +#begin Textures/Animations/player_look_up.animation +/copy:Textures/Animations/player_look_up.animation + #begin Textures/Animations/player_right_idle.animation /copy:Textures/Animations/player_right_idle.animation @@ -224,18 +224,6 @@ #begin Textures/Animations/zombie_walk.animation /copy:Textures/Animations/zombie_walk.animation -#begin Textures/AnimationTextures/Character/hr-level1_idle.png -/importer:TextureImporter -/processor:TextureProcessor -/processorParam:ColorKeyColor=255,0,255,255 -/processorParam:ColorKeyEnabled=True -/processorParam:GenerateMipmaps=False -/processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False -/processorParam:MakeSquare=False -/processorParam:TextureFormat=Color -/build:Textures/AnimationTextures/Character/hr-level1_idle.png - #begin Textures/AnimationTextures/Character/hr-level1_idle_gun.png /importer:TextureImporter /processor:TextureProcessor @@ -248,6 +236,18 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/Character/hr-level1_idle_gun.png +#begin Textures/AnimationTextures/Character/hr-level1_idle.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/AnimationTextures/Character/hr-level1_idle.png + #begin Textures/AnimationTextures/Character/hr-level1_mining_tool-1.png /importer:TextureImporter /processor:TextureProcessor @@ -272,18 +272,6 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/Character/hr-level1_mining_tool-2.png -#begin Textures/AnimationTextures/Character/hr-level1_running.png -/importer:TextureImporter -/processor:TextureProcessor -/processorParam:ColorKeyColor=255,0,255,255 -/processorParam:ColorKeyEnabled=True -/processorParam:GenerateMipmaps=False -/processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False -/processorParam:MakeSquare=False -/processorParam:TextureFormat=Color -/build:Textures/AnimationTextures/Character/hr-level1_running.png - #begin Textures/AnimationTextures/Character/hr-level1_running_gun.png /importer:TextureImporter /processor:TextureProcessor @@ -296,6 +284,18 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/Character/hr-level1_running_gun.png +#begin Textures/AnimationTextures/Character/hr-level1_running.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/AnimationTextures/Character/hr-level1_running.png + #begin Textures/AnimationTextures/unicorn.png /importer:TextureImporter /processor:TextureProcessor @@ -416,18 +416,6 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/background/waiting.png -#begin Textures/GUI/checkboxs_off.png -/importer:TextureImporter -/processor:TextureProcessor -/processorParam:ColorKeyColor=255,0,255,255 -/processorParam:ColorKeyEnabled=True -/processorParam:GenerateMipmaps=False -/processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False -/processorParam:MakeSquare=False -/processorParam:TextureFormat=Color -/build:Textures/GUI/checkboxs_off.png - #begin Textures/GUI/checkboxs_off-on.png /importer:TextureImporter /processor:TextureProcessor @@ -440,6 +428,18 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/checkboxs_off-on.png +#begin Textures/GUI/checkboxs_off.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/GUI/checkboxs_off.png + #begin Textures/GUI/checkboxs_on.png /importer:TextureImporter /processor:TextureProcessor @@ -476,18 +476,6 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/mouse.png -#begin Textures/GUI/switch.png -/importer:TextureImporter -/processor:TextureProcessor -/processorParam:ColorKeyColor=255,0,255,255 -/processorParam:ColorKeyEnabled=True -/processorParam:GenerateMipmaps=False -/processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False -/processorParam:MakeSquare=False -/processorParam:TextureFormat=Color -/build:Textures/GUI/switch.png - #begin Textures/GUI/Switch_backgrownd.png /importer:TextureImporter /processor:TextureProcessor @@ -500,6 +488,18 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/Switch_backgrownd.png +#begin Textures/GUI/switch.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/GUI/switch.png + #begin Textures/icons/12.png /importer:TextureImporter /processor:TextureProcessor @@ -704,6 +704,18 @@ /processorParam:TextureFormat=Color /build:Textures/icons/Collectables/Wood.png +#begin Textures/icons/ExitZone.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Textures/icons/ExitZone.png + #begin Textures/icons/Material/Fabric.png /importer:TextureImporter /processor:TextureProcessor diff --git a/ZoFo/Content/Textures/icons/ExitZone.png b/ZoFo/Content/Textures/icons/ExitZone.png new file mode 100644 index 0000000..0ff693d Binary files /dev/null and b/ZoFo/Content/Textures/icons/ExitZone.png differ diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index bd41aa1..b7a50c1 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -206,8 +206,16 @@ namespace ZoFo.GameCore DeleteObject(ent); } + else if (update is UpdateGameEnded) + { + GameEnd(); + } } + public void GameEnd() + { + AppManager.Instance.SetGUI(new FinishingGUI()); + } public Entity FindEntityById(int id) { diff --git a/ZoFo/GameCore/GameObjects/ExitZone.cs b/ZoFo/GameCore/GameObjects/ExitZone.cs new file mode 100644 index 0000000..5a12e2c --- /dev/null +++ b/ZoFo/GameCore/GameObjects/ExitZone.cs @@ -0,0 +1,42 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.GameManagers.CollisionManager; +using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; +using ZoFo.GameCore.Graphics; + +namespace ZoFo.GameCore.GameObjects +{ + public class ExitZone : Entity + { + + + public override GraphicsComponent graphicsComponent { get; } = new StaticGraphicsComponent("Textures/icons/ExitZone"); + public ExitZone(Vector2 position) : base(position) + { + collisionComponent.OnTriggerZone += Exit; + graphicsComponent.ObjectDrawRectangle.Width = 100; + graphicsComponent.ObjectDrawRectangle.Height = 100; + position = new Vector2(500f, 500f); + collisionComponent.isTrigger = true; + collisionComponent.triggerRectangle = new Rectangle(0, 0, 100, 100); + } + + + public void Exit(GameObject sender) + { + if (sender is Player && + AppManager.Instance.server.collisionManager.GetPlayersInZone(collisionComponent.triggerRectangle.SetOrigin(position)).Length == AppManager.Instance.server.players.Count) + { + sender.position = new Vector2(0f, 0f); + AppManager.Instance.server.EndGame(); + AppManager.Instance.debugHud.Set("Exit", sender.position.ToString()); + } + } + } +} diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index a2b85d7..eaa57fc 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -146,6 +146,7 @@ namespace ZoFo.GameCore AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(140, 440))); AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(240, 440))); + AppManager.Instance.server.RegisterGameObject(new ExitZone(new Vector2(240, 440))); } /// @@ -155,7 +156,7 @@ namespace ZoFo.GameCore { UpdateGameEnded gameEnded = new UpdateGameEnded(); networkManager.AddData(gameEnded); - networkManager.CloseConnection(); + // networkManager.CloseConnection(); } public List gameObjects;