Ejemplo n.º 1
0
        /// <summary>
        /// Is any transformation key pressed
        /// </summary>
        /// <param name="input"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        static bool IsTransformationKeyPressed(MyGuiInput input, Keys key)
        {
            bool result = false;
            MyEntity entity = GetFirstSelected();
            //when the key is pressed for a longer period, allow to move object constantly in chosen direction and not only in one step
            if (input.IsKeyPress(key))
            {
                if (input.WasKeyPressed(key) == false)
                {
                    m_delayObjectMovementInMillis = MyMinerGame.TotalGamePlayTimeInMilliseconds;
                    result = input.IsNewKeyPress(key);
                }
                else
                {
                    if (IsDelayForSmoothMovementReached())
                    {
                        result = true;
                    }
                }
            }

            if (result) TransformationActive = true;

            return result;
        }