Esempio n. 1
0
        IEnumerator DigToRight()
        {
            Destructible block;

            if (BoardModel.GetBlock <Destructible>(_transform.position + Vector3.right, out block))
            {
                block.Destruct(1);
                _sound.PlayRandomClip(ClipStorage.instance.drillInstrumentClips);
                yield return(new WaitForSeconds(1));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Использовать инструмент
        /// </summary>
        /// <param name="direction">Направление движения шасси</param>
        /// <returns>Сопрограмма</returns>
        public IEnumerator Use(bool direction)
        {
            yield return(new WaitForSeconds(1f));

            Instantiate(ObjectStorage.instance.bomb, _transform.position, Quaternion.identity);
            _sound.PlayRandomClip(ClipStorage.instance.bomberInstrumentClips);
            _robot.SwitchInstrument();
        }
Esempio n. 3
0
        private IEnumerator MakeStep(Vector3 direction, float speed)
        {
            float   t   = 0;
            Vector3 pos = _transform.position;

            _sound.PlayRandomClip(ClipStorage.instance.flyShassisClips);

            while (t <= speed)
            {
                _transform.position = Vector3.Lerp(pos, pos + direction, t / speed);
                t += Time.deltaTime;
                yield return(null);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Собрать ресурс
        /// </summary>
        public void Collect()
        {
            _sound.PlayRandomClip(collectClips);
            GameManager.instance.Batterys += points;
            ResourceCount--;

            if (ResourceCount <= 0)
            {
                GameManager.instance.NextLevel();
            }

            GetComponent <BoxCollider2D>().enabled  = false;
            GetComponent <SpriteRenderer>().enabled = false;

            Destroy(gameObject, 2f);
        }
Esempio n. 5
0
 private IEnumerator MakeStepRight()
 {
     _animator.SetInteger("AnimState", 1);
     _sound.PlayRandomClip(ClipStorage.instance.jumpShassisClips);
     yield return(StartCoroutine(MakeStep(Vector3.right, 1)));
 }