Пример #1
0
        /// <summary>
        /// Spawns a bomb
        /// </summary>
        protected virtual void SpawnBomb()
        {
            // we decide where to put our bomb
            //DetermineBombSpawnPosition();
            return;

            _newPosition = this.transform.position;
            print("DetermineBombSpawnPosition = " + _newPosition);;

            // if there's already a bomb there, we exit

            /*if (_alreadyBombed)
             * {
             *  if (_lastBombPosition == _newPosition)
             *  {
             *      return;
             *  }
             * }*/

            // if we don't have bombs left, we exit
            if (RemainingBombs <= 0)
            {
                return;
            }
            print("SpawnBomb");
            // we pool a new bomb
            GameObject nextGameObject = _objectPool.GetPooledGameObject();

            if (nextGameObject == null)
            {
                return;
            }

            print("SpawnBombComplete");
            // we setup our bomb and activate it
            nextGameObject.transform.position = _newPosition;
            _bomb       = nextGameObject.MMGetComponentNoAlloc <ExplodudesBomb>();
            _bomb.Owner = Owner.gameObject;
            _bomb.BombDelayBeforeExplosion = BombDelayBeforeExplosion;
            nextGameObject.gameObject.SetActive(true);

            // we lose one bomb and prepare to add it back
            RemainingBombs--;
            StartCoroutine(AddOneRemainingBombCoroutine());

            // we change our state
            WeaponState.ChangeState(WeaponStates.WeaponUse);
            _alreadyBombed    = true;
            _lastBombPosition = _newPosition;
        }
Пример #2
0
    IEnumerator FillDust()
    {
        CassetteTransform.DOMoveY(-4, 0.75f);
        yield return(new WaitForSeconds(0.75f));

        Vector3 _pos = CassetteTransform.position;

        _pos.y = 12;

        int _target = Random.Range(0, 2);

        if (_target == 0)
        {
            _renderer.materials       = GameplayController.Instance.MaterailSet1;
            _renderer_bottom.material = GameplayController.Instance.MaterailSet1[0];
        }
        else
        {
            _renderer.materials       = GameplayController.Instance.MaterailSet2;
            _renderer_bottom.material = GameplayController.Instance.MaterailSet2[0];
        }

        CassetteTransform.position = _pos;

        CassetteTransform.DOMove(_oriCassettePos, 0.75f);
        yield return(new WaitForSeconds(0.75f));

        _pos = Vector3.zero;
        float _scale;

        for (int i = 0; i < AmountOfDust; i++)
        {
            var dustObj = _dustPool.GetPooledGameObject();

            Dust _dustScript = dustObj.GetComponent <Dust>();
            _dustScript.AttachedBlowManager = this;

            _pos.z = Random.Range(MinDustSpawnPosition, MaxDustSpawnPosition);

            dustObj.transform.localPosition = _pos;

            _scale = Random.Range(MinDustScale, MaxDustScale);
            dustObj.transform.localScale = new Vector3(_scale, _scale, _scale);

            dustObj.SetActive(true);
        }
        _remainingDustAmount         = AmountOfDust;
        _progressBarImage.fillAmount = 1;
    }