void Awake() { _spr = Resources.Load <Sprite>("NormalBullet"); _sprLaser = Resources.Load <Sprite>("Laser"); _sprAuto = Resources.Load <Sprite>("Automatic"); _shipSpriteRenderer = GetComponent <SpriteRenderer>(); var sprites = Resources.LoadAll("Ships"); _sprsShip[0] = (Sprite)sprites[6]; _sprsShip[1] = (Sprite)sprites[8]; _sprsShip[2] = (Sprite)sprites[5]; _sprsShip[3] = (Sprite)sprites[1]; _shipSpriteRenderer.sprite = _sprsShip[3]; _bulletSpawner = GetComponent <BulletsSpawner>(); _rb = GetComponent <Rigidbody2D>(); _controller = new ShipController(this, false); _shootBehaviour = new BaseShoot(_bulletSpawner, spawnerFront, new BaseBullet(), _spr); mainCamera = Camera.main; EventsManager.SubscribeToEvent("ShipDefeated", OnShipDefeated); EventsManager.SubscribeToEvent("ShipDamaged", ShipDamaged); EventsManager.SubscribeToEvent("Win", Unsuscribe); EventsManager.SubscribeToEvent("Lose", Unsuscribe); }
public override void UpdateGun() { base.UpdateGun(); _originalBehaviour = gun.ShootBehaviour; gun.ShootBehaviour = newBehaviour; newBehaviour.Init(); Debug.Log("Triple Shot BBY!"); }
public void BaseFire() { ShootEnd(); _controller = new ShipController(this, false); _shootBehaviour = new BaseShoot(_bulletSpawner, spawnerFront, new BaseBullet(), _spr); }
public void AutomaticFire() { ShootEnd(); _controller = new ShipController(this, true); _shootBehaviour = new AutomaticShoot(_bulletSpawner, spawnerFrontRight, spawnerFrontLeft, new AutomaticBullet(), _sprAuto); }
private void Awake() { newBehaviour = GetComponent <IShootBehaviour>(); }