コード例 #1
0
 /// <summary>
 /// Emits bullets use given parameters.
 /// </summary>
 /// <param name="shape">Bullet parameters</param>
 /// <param name="bullet">The bullet type to emit</param>
 /// <param name="emitter">Bullets will be emitted relative to it</param>
 public void Emit(IEnumerable <BulletEmitParam> shape, IBulletSystem bullet, Transform emitter)
 {
     foreach (var emitParam in shape)
     {
         Emit(emitParam, bullet, emitter);
     }
 }
コード例 #2
0
 /// <summary>
 /// Creates a storm info.
 /// </summary>
 /// <param name="bulletSystems">This tells the storm how to find bullets by name.</param>
 /// <param name="defaultBulletSystem">Use default bullet system if bullet name not found.</param>
 public StormInfo([NotNull] IReadOnlyDictionary <string, IBulletSystem> bulletSystems,
                  [NotNull] IBulletSystem defaultBulletSystem)
 {
     bulletSystemDictionary   = bulletSystems;
     this.defaultBulletSystem = defaultBulletSystem;
     Compiled = false;
 }
コード例 #3
0
 private IBulletController GetBulletController(IBulletSystem bullet)
 {
     if (bulletSystems.TryGetValue(bullet, out var result))
     {
         return(result);
     }
     result = bullet.GetController();
     bulletSystems.Add(bullet, result);
     return(result);
 }
コード例 #4
0
        /// <summary>
        ///     Set reference system for a bullet system. After calling this, emitted bullets will take given rotation
        ///     their reference system. This function won't change reference system of already emitted bullets.
        /// </summary>
        /// <param name="bulletSystem"></param>
        /// <param name="rotation"></param>
        protected void SetReferenceSystem(IBulletSystem bulletSystem, Quaternion rotation)
        {
            if (bulletSystems.TryGetValue(bulletSystem, out var controller))
            {
                controller.Destroy();
            }
            var newController = bulletSystem.GetController();

            newController.Rotation      = rotation;
            bulletSystems[bulletSystem] = newController;
        }
コード例 #5
0
ファイル: EnemyFlyer.cs プロジェクト: MarkosUA/Archer
 private void Construct(IPrefabsCreater prefabsCreater, CharactersData charactersData, GameSettings gameSettings,
                        IChooserRandPosToMove chooserRandPosToMove, IBulletSystem bulletSystem, IEnemyRemover enemyRemover)
 {
     _prefabsCreater       = prefabsCreater;
     _navMeshAgent         = GetComponent <NavMeshAgent>();
     _navMeshAgent.speed   = charactersData.EnemyFlyerData.CharacterSpeed;
     _enemyFlyerHP         = charactersData.EnemyFlyerData.CharacterHp;
     _gameSettings         = gameSettings;
     _chooserRandPosToMove = chooserRandPosToMove;
     _bulletSystem         = bulletSystem;
     _enemyRemover         = enemyRemover;
 }
コード例 #6
0
ファイル: Player.cs プロジェクト: MarkosUA/Archer
 private void Construct(Joystick joystick, CharactersData charactersData, IBulletSystem bulletSystem,
                        IPrefabsCreater prefabsCreater, GameSettings gameSettings, IEndGame endGame, IPlayerHealth playerHealth)
 {
     _joystick       = joystick;
     _navMeshAgent   = GetComponent <NavMeshAgent>();
     _playerHP       = charactersData.PlayerData.CharacterHp;
     _playerSpeed    = charactersData.PlayerData.CharacterSpeed;
     _bulletSystem   = bulletSystem;
     _prefabsCreater = prefabsCreater;
     _gameSettings   = gameSettings;
     _endGame        = endGame;
     _playerHealth   = playerHealth;
     _playerHealth.ChangeHealth(_playerHP);
     _canShoot = true;
 }
コード例 #7
0
ファイル: EnemyBoss.cs プロジェクト: MarkosUA/Archer
 private void Construct(IPrefabsCreater prefabsCreater, CharactersData charactersData, GameSettings gameSettings,
                        IChooserRandPosToMove chooserRandPosToMove, BulletData bulletData, IBulletSystem bulletSystem,
                        IEnemyRemover enemyRemover)
 {
     _prefabsCreater         = prefabsCreater;
     _navMeshAgent           = GetComponent <NavMeshAgent>();
     _navMeshAgent.speed     = charactersData.EnemyBossData.CharacterSpeed;
     _enemyBossHP            = charactersData.EnemyBossData.CharacterHp;
     _charactersData         = charactersData;
     _gameSettings           = gameSettings;
     _chooserRandPosToMove   = chooserRandPosToMove;
     _canAttack              = true;
     _bulletData             = bulletData;
     _countOfTheBulletSeries = bulletData.CountOfTheBulletSeriesForBoss;
     _bulletSystem           = bulletSystem;
     _enemyRemover           = enemyRemover;
 }
コード例 #8
0
 /// <summary>
 /// Emits a single bullet.
 /// </summary>
 /// <param name="emitParam">Parameters of the bullet</param>
 /// <param name="bullet">The bullet type to emit</param>
 /// <param name="emitter">Bullet will be emitted relative to it</param>
 public void Emit(BulletEmitParam emitParam, IBulletSystem bullet, Transform emitter) =>
 GetBulletController(bullet).Emit(emitParam, emitter);
コード例 #9
0
 /// <summary>
 /// Emits a single bullet from this emitter.
 /// </summary>
 /// <param name="emitParam">Parameters of the bullet</param>
 /// <param name="bullet">The bullet type to emit</param>
 public virtual void Emit(BulletEmitParam emitParam, IBulletSystem bullet) =>
 Emit(emitParam, bullet, transform);
コード例 #10
0
 /// <summary>
 /// Emits bullets use given parameters from this emitter.
 /// </summary>
 /// <param name="shape">Bullet parameters</param>
 /// <param name="bullet">The bullet type to emit</param>
 public virtual void Emit(IEnumerable <BulletEmitParam> shape, IBulletSystem bullet) =>
 Emit(shape, bullet, transform);