public RedLaser(Weapon newweapon, IMediator mediator) : base(mediator) { newweapon.LaserSight = new string("Red"); newweapon.LaserSprite = new Sprite(TextureHolder.GetInstance().Get(TextureIdentifier.RedLaser)); CheckGun(newweapon.Name, newweapon); //this.Origin = new Vector2f(SpriteUtils.GetSpriteCenter(this).X, 3f); }
public Button() { normalTexture = TextureHolder.GetInstance().Get(TextureIdentifier.ButtonDefault); selectedTexture = TextureHolder.GetInstance().Get(TextureIdentifier.ButtonSelected); pressedTexture = TextureHolder.GetInstance().Get(TextureIdentifier.ButtonClicked); sprite = new Sprite(); text = new Text(string.Empty, ResourceHolderFacade.GetInstance().Fonts.Get(FontIdentifier.PixelatedSmall), 16); sprite.Texture = normalTexture; var bounds = sprite.GetLocalBounds(); text.Position = new Vector2f(bounds.Width / 2, bounds.Height / 2); }
public AssaultRifle(IMediator mediator) : base(mediator) { this.Name = "AK-47"; this.MagazineSize = 45; this.Ammo = 45; this.Damage = 25; this.ProjectileSpeed = 2000; this.AttackSpeed = 90; this.ReloadDuration = 800; this.Projectiles = new List <Projectile>(); this.SpreadAmount = 50; this.CanShoot = true; this.ProjectileSprite = new Sprite(TextureHolder.GetInstance().Get(TextureIdentifier.Bullet)); this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.GunAk47); this.Origin = new Vector2f(SpriteUtils.GetSpriteCenter(this).X, 3f); }
public Flamethrower(IMediator mediator) : base(mediator) { this.Name = "FlameThrower"; this.MagazineSize = 200; this.Ammo = 200; this.Damage = 10; this.ProjectileSpeed = 500; this.AttackSpeed = 20; this.ReloadDuration = 2000; this.Projectiles = new List <Projectile>(); this.SpreadAmount = 50; this.CanShoot = true; this.ProjectileSprite = new Sprite(TextureHolder.GetInstance().Get(TextureIdentifier.Bullet)); this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.Flamethrower); this.Origin = new Vector2f(SpriteUtils.GetSpriteCenter(this).X, 3f); }
public void CheckGun(string text, Weapon newweapon) { //if (text == "Pistol") //{ // newweapon.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.RedPistolLaser); // newweapon.LaserSprite.Origin = new Vector2f(SpriteUtils.GetSpriteCenter(this).X, 3f); //} if (text == "AK-47") { newweapon.Name = "AK-47R"; newweapon.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.RedGunAk47Laser); newweapon.LaserSprite.Origin = new Vector2f(SpriteUtils.GetSpriteCenter(this).X, 8f); } else if (text == "Sniper") { newweapon.Name = "SniperR"; newweapon.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.RedSniperLaser); newweapon.LaserSprite.Origin = new Vector2f(SpriteUtils.GetSpriteCenter(this).X, 10f); } }
// ======================================================================== // =========================== MAIN ENTRY POINT =========================== // ======================================================================== public void Run() { // set up loggers using chain of responsibility pattern Console.ForegroundColor = ConsoleColor.White; defaultLogger.SetNext(importantLogger); importantLogger.SetNext(fileLogger); fileLogger.SetNext(criticalLogger); criticalLogger.SetNext(null); defaultLogger.LogMessage(60, "Loggers setup!"); // Create render window GameWindow = CreateRenderWindow(Styles.Close); Vector2f winSize = GameWindow.GetView().Size; // Load resources CreateSprites(); GameState.InitRandom(5); builder = new MapBuilder(); builder.LoadSprites(); director = new Director(builder); director.Construct(); GameState.TileMap = builder.GetResult(); // Portal creation PortalProspect portal = new PortalProspect(); Caretaker m1 = new Caretaker(); Caretaker m2 = new Caretaker(); portal.Pos = new Vector2f(3 * 64f, 45 * 64f); portal.Tex = TextureHolder.GetInstance().Get(TextureIdentifier.Portal); m1.Memento = portal.CreateMemento(); portal.Pos = new Vector2f(60 * 64f, 3 * 64f); portal.Tex = TextureHolder.GetInstance().Get(TextureIdentifier.PortalRed); m2.Memento = portal.CreateMemento(); GameState.NonCollidableRep.GetIterator().Add(portal); // Generate additional objects (destructibles, indestructibles, pickupables) SpawningManager(20, 15, 60, 20); // View MainView = GameWindow.DefaultView; ZoomedView = new View(MainView); GameWindow.SetView(ZoomedView); // weapon prototype weaponProtoype = new Pistol(mediator); // Player init CreateMainPlayer(); mediator.GetPlayerText(MainPlayer.PlayerBar); ConnectionManager connectionManager = new ConnectionManager("http://underpoweredserver.tplinkdns.com:51230/sd-server"); GameState.ConnectionManagerProxy = new Managers.Proxy.ConnectionManagerProxy(connectionManager); bool isPlayerSpawned = ForceSpawnObject(MainPlayer); if (isPlayerSpawned) { GameState.PlayerRep.GetIterator().Add(MainPlayer); GameState.PlayerRep.GetIterator().Add(SpawnFakePlayer(4000, 2000)); GameState.PlayerRep.GetIterator().Add(SpawnFakePlayer(4000, 2200)); GameState.PlayerRep.GetIterator().Add(SpawnFakePlayer(4000, 2400)); } PlayerEventManager.Subscribe(PlayerEventType.KilledPlayer, GameplayUI.KillNotifier); PlayerEventManager.Subscribe(PlayerEventType.KilledPlayer, GameplayUI.Scoreboard); var mPos = GameWindow.MapPixelToCoords(Mouse.GetPosition(GameWindow)); while (GameWindow.IsOpen) { GameWindow.Clear(); GameWindow.DispatchEvents(); if (this.HasFocus) { this.ProccesKeyboardInput(); mPos = GameWindow.MapPixelToCoords(Mouse.GetPosition(GameWindow)); } Time deltaTime = FrameClock.Restart(); if (GameState.ConnectionManagerProxy.ActivityClock.ElapsedTime.AsSeconds() > (1f / multiplayerSendRate) && GameState.ConnectionManagerProxy.IsConnected()) { GameState.ConnectionManagerProxy.ActivityClock.Restart(); SendPos(GameState.ConnectionManagerProxy.Connection); } var middlePoint = VectorUtils.GetMiddlePoint(MainPlayer.Position, mPos); MainPlayer.Heading = VectorUtils.GetAngleBetweenVectors(MainPlayer.Position, mPos); MainPlayer.LookingAtPoint = mPos; SpawnPortal(portal, m1, m2); UpdateLoop(deltaTime, mPos); lock (SFMLLock) { DrawLoop(); GameWindow.SetView(MainView); GameWindow.Draw(GameplayUI.Scoreboard); GameWindow.Draw(GameplayUI.RespawnMesage); GameWindow.Draw(GameplayUI.KillNotifier); GameWindow.Draw(GameplayUI.InGameLog); if (container.Show) { GameWindow.Draw(container.composite); } ZoomedView.Center = middlePoint; ZoomedView.Zoom(zoomView); zoomView = 1.0f; GameWindow.SetView(ZoomedView); GameWindow.Display(); } } }
public ReloadSyringe() { this.PowerUpStrategy = new ReloadSpeedStrategy(); this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.ReloadSyringe); }
public override Sprite ApplySkin() { return(new Sprite(TextureHolder.GetInstance().Get(TextureIdentifier.DamageTrap))); }
public MovementSyringe() { this.PowerUpStrategy = new MovmentSpeedStrategy(); this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.MovementSyringe); }
public Wall() { this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.Wall); }
public FreezeTrapBuilder() { this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.FreezeTrap); }
public Medkit() { this.PowerUpStrategy = new HealingStrategy(); this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.Medkit); }
public HealingSyringe() { this.PowerUpStrategy = new HealingStrategy(); this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.HealingSyringe); }
public Bush() { this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.Bush); }
//Choose textures for collidables public void LoadSprites() { Wall = new Sprite(TextureHolder.GetInstance().Get(TextureIdentifier.Wall)); }
public BarbWire() { this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.BarbWire); }
public RemoveAmmoTrapBuilder() { this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.RemoveAmmoTrap); }
public DamageTrapBuilder() { this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.DamageTrap); }
public DeflectionSyringe() { this.PowerUpStrategy = new DeflectionStrategy(); this.Texture = TextureHolder.GetInstance().Get(TextureIdentifier.DeflectionSyringe); }