Exemplo n.º 1
0
        /// <summary>
        /// Передвинуть
        /// </summary>
        /// <param name="direction">Направление движения</param>
        /// <returns>Сопрограмма</returns>
        public IEnumerator MoveTo(Vector3 direction)
        {
            if (BoardModel.CheckForEmpty(_transform.position + direction))
            {
                _source.PlayOneShot(moveClip);

                float   t   = 0;
                Vector3 pos = _transform.position;

                while (t <= MovingSpeed)
                {
                    _transform.position = Vector3.Lerp(pos, pos + direction, t / MovingSpeed);
                    t += Time.deltaTime;
                    yield return(null);
                }

                UtilityFunctions.Leveling(_transform);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Прикрепить шасси к роботу
        /// </summary>
        /// <param name="code">Код шасси</param>
        public void SetShassis(ShassisEnum code)
        {
            Type shassis = UtilityFunctions.TranslateShassisCodeToType(code);

            _shassis = gameObject.AddComponent(shassis) as IShassis;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Прикрепить инструмент к роботу
        /// </summary>
        /// <param name="code">Код инструмента</param>
        public void SetInstrument(InstrumentsEnum code)
        {
            Type instrument = UtilityFunctions.TranslateInstrumentCodeToType(code);

            _instrument = gameObject.AddComponent(instrument) as IInstrument;
        }