コード例 #1
0
ファイル: AudioData.cs プロジェクト: AirCoder89/SpaceInvaders
        private AudioSource AssignClipData(AudioSource inSource)
        {
            if (inSource == null)
            {
                GameExceptions.NullReference($"Audio Source is null! you have to increase the pool size.");
            }

            inSource.clip  = this.clip;
            inSource.pitch = this.pitch;
            inSource.loop  = this.loop;
            return(inSource);
        }
コード例 #2
0
        public InvadersSystem(SystemConfig inConfig = null) : base(inConfig)
        {
            if (inConfig != null)
            {
                _config = inConfig as InvadersConfig;
            }
            if (inConfig == null)
            {
                GameExceptions.NullReference($"InvadersConfig must be not null!");
            }

            _shootingTimer = new Timer(_config.behaviours.shootingRate, Shoot);

            InvaderView.OnDestroyed        += OnDestroyInvader;
            LevelSystem.OnHitVerticalEdges += () => _hasToReverse = true;

            //- create special ship
            _specialShip = new SpecialShip("SpecialShip", _config.specialShip);
            _specialShip.SetParent(GameState.GameHolder);
        }