public void SpaceshipsCollision(Spaceship spaceship, UnitBattleIdentity unitBattleIdentity) //Столкновение кораблей { if (_battleIdentity == unitBattleIdentity) { return; } spaceship.Death(); Death(); }
protected override void ProcessCheckBorders(UnitBattleIdentity identity) { if (identity != UnitBattleIdentity.Enemy) { return; } if (GameAreaHelper.CheckPlayArea(transform, _hull.bounds)) { _spaceShip.HealthSystem.Die(); } }
protected override void ProcessCheckBorders(UnitBattleIdentity identity) { if (identity != UnitBattleIdentity.Player) { return; } if (GameAreaHelper.CheckBorders(transform) < 0) { transform.position = new Vector2(GameAreaHelper.LeftBound, transform.position.y); } if (GameAreaHelper.CheckBorders(transform) > 0) { transform.position = new Vector2(GameAreaHelper.RightBound, transform.position.y); } }
private void LockOnTarget(UnitBattleIdentity identity) { var ships = FindObjectsOfType <Spaceship>(); foreach (var ship in ships) { if (ship is IDamagable damagable) { if (damagable.BattleIdentity == identity) { _target = ship.gameObject.transform; _direction = transform.position - _target.position; // при нахождении цели записываем направление к ней, расчитывается только один раз break; } } } }
public void Init(UnitBattleIdentity battleIdentity) { _battleIdentity = battleIdentity; switch (_weaponType) { case WeaponType.Laser: _projectile = Resources.Load <Projectile>("ProjType/Laser"); break; case WeaponType.Rocket: _projectile = Resources.Load <Projectile>("ProjType/Rocket"); break; case WeaponType.Plasma: _projectile = Resources.Load <Projectile>("ProjType/Plasma"); break; } _bulletsPool = new ProjectilePool(_projectile, 10); }
public void Init(UnitBattleIdentity battleIdentity) { _battleIdentity = battleIdentity; }
public void Init(UnitBattleIdentity battleIdentity) { _weapons.ForEach(w => w.Init(battleIdentity)); }
public override void Init(UnitBattleIdentity battleIdentity) { base.Init(battleIdentity); }
public void Init(UnitBattleIdentity battleIdentity) { _battleIdentity = battleIdentity; _guns.ForEach(w => w.Init(battleIdentity)); _missileLauncher.ForEach(w => w.Init(battleIdentity)); }
public override void Init(UnitBattleIdentity battleIdentity) { base.Init(battleIdentity); FindTarget(); // ищем цель ракеты }
protected abstract void ProcessCheckBorders(UnitBattleIdentity identity);
private UnitBattleIdentity _battleIdentity; //used to distinguish enemies from allies //Initialize this weapon public void Init(UnitBattleIdentity battleIdentity) { _battleIdentity = battleIdentity; _originalCooldown = _cooldown; }