示例#1
0
        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);
        }
        public void Shoot(Vector3 inPosition, Vector3 inDirection, LayerMask inLayerMask, string by)
        {
            var bullet = ObjectPool.GetObject <BulletView>();

            if (bullet == null)
            {
                GameExceptions.Exception($"Pool is Empty! increase the size of the buffer.");
            }

            AudioSystem.Play(AudioLabel.Shoot);
            bullet.Launch(inPosition, inDirection, inLayerMask, by);
            bullet.onDspawn += OnDespawnBullet;
            _bulletsInScene.Add(bullet);
        }
示例#3
0
        private static void SendRequest(RequestHelper request, Action <string> onCompleted, Action <string> onFailed)
        {
            if (!_isInitialized)
            {
                GameExceptions.Exception($"RestClient must be initialized to send request.");
            }

            Proyecto26.RestClient.Request(request)

            .Then(response =>
            {
                onCompleted?.Invoke(response.Text);
                Proyecto26.RestClient.ClearDefaultHeaders();
            })
            .Catch(err => onFailed?.Invoke(err.Message));
        }
示例#4
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);
        }