Exemplo n.º 1
0
Arquivo: Gem.cs Projeto: zehreken/vd
 private void OnCollision(Collider collider)
 {
     IsActive = false;
     _view.SetActive(false);
     ObstacleUtils.CreateGemParticle(_transform.position);
     Services.GetAudioService().Play(Clip.CollectGem);
 }
Exemplo n.º 2
0
        private void SpawnObstacle()
        {
            if (_remainingPatterns == 0)
            {
                _currentPattern    = ObstacleUtils.CreateRandomPattern();
                _remainingPatterns = _currentPattern.Length;
                _color             = ObstacleUtils.GetRandomColor();
            }

            GetObstacle().Init(_currentPattern[_currentPattern.Length - _remainingPatterns], _color);
            _remainingPatterns--;
        }
Exemplo n.º 3
0
Arquivo: Actor.cs Projeto: zehreken/vd
 private void OnCollision(Collider collider)
 {
     if (collider.CompareTag("Obstacle"))
     {
         _particleSystem.Stop();
         ObstacleUtils.CreateActorParticle(_transform.position);
         Services.GetAudioService().Play(Clip.Hit);
         _view.SetActive(false);
         Main.Instance.StopGame();
     }
     else if (collider.CompareTag("Gem"))
     {
         Services.GetScoreService().AddGem(1);
     }
 }
Exemplo n.º 4
0
        public void Init(ObstacleTemplate template, Color color)
        {
            _view      = MiniPool.Create(template.PrefabName, new Vector3(0f, 0f, 100f));
            _transform = _view.transform;
            _transform.localEulerAngles = new Vector3(0f, 0f, template.StartAngle);
            _behaviour = ObstacleUtils.GetBehaviour(template.BehaviourType);

            if (_behaviour != null)
            {
                _behaviour.Init(_transform, template.Direction);
            }

            IsActive    = true;
            _scaleTimer = 0f;
            foreach (var renderer in _view.GetComponentsInChildren <Renderer>())
            {
                renderer.material.SetColor("_MainColor", color);
            }
        }