private void LateUpdate() { if (CanShoot()) { foreach (var weapon in currentWeapons) { ShotFactory.Fire(weapon.Weapon, projectile, shotForce, this); animator.SetTrigger("PlayerShoot"); } } }
public void SetUp() { _container = new DiContainer(); SignalBusInstaller.Install(_container); _container.DeclareSignal <SignalShotDestroy>(); _signalBus = _container.Resolve <SignalBus>(); _container.BindInterfacesAndSelfTo <ShotsMoveSystem>().AsSingle().NonLazy(); _container.BindInterfacesAndSelfTo <ShotFactory>().AsSingle().NonLazy(); _container.BindInterfacesAndSelfTo <Engine>().AsSingle().NonLazy(); _engine = _container.Resolve <Engine>(); _shotsMoveSystem = _container.Resolve <ShotsMoveSystem>(); _shotFactory = _container.Resolve <ShotFactory>(); }
public override void LoadContent(TextureManager textureManager) { Texture2D spriteSheet = textureManager.OptionalLoadContent <Texture2D>(@"Textures\SpriteSheet"); _tileMap.Intialise(spriteSheet); //_player = new Player( // spriteSheet, // new Rectangle(0, 64, 32, 32), 6, // new Rectangle(0, 96, 32, 32), 1, // new Vector2(300, 300), // _cam //); Rectangle playerBaseInitialRectangle = new Rectangle(0, 64, 32, 32); Rectangle playerTurretInitialRectangle = new Rectangle(0, 96, 32, 32); Vector2 playerLocation = new Vector2(300, 300); WorldSprite playerBase = new WorldSprite(spriteSheet, playerBaseInitialRectangle, _cam); WorldSprite playerTurret = new WorldSprite(spriteSheet, playerTurretInitialRectangle, _cam); playerBase.AddAnimation(6); _player = new Player(playerBase, playerTurret, _cam) { WorldLocation = playerLocation }; Rectangle particleRect = new Rectangle(0, 288, 2, 2); Rectangle explosionParticleRect = new Rectangle(0, 256, 32, 32); WorldTileSheet explosionTileSheet = new WorldTileSheet(spriteSheet, particleRect, _cam); WorldTileSheet particleTileSheet = new WorldTileSheet(spriteSheet, explosionParticleRect, _cam, 3); _effectsManager = new EffectsManager(explosionTileSheet, particleTileSheet); // Shots Rectangle shotRect = new Rectangle(0, 128, 32, 32); WorldTileSheet shotTileSheet = new WorldTileSheet(spriteSheet, shotRect, _cam, 2); ShotFactory shotFactory = new ShotFactory(shotTileSheet, _cam); _shotManager = new ShotManager(shotFactory); //_shotManager.OnShotDestroyed += OnShotDestroyed; _shotManager.OnShotCollision += OnShotCollision; _player.ShotFired += PlayerShotFired; }