コード例 #1
0
        public static byte GetRoundedMaxFramesForPositionChange(Vector3 positionChange)
        {
            int xSimulationPositionChange = UnitValueConverter.ToSimulationPosition(Mathf.Abs(positionChange.x));
            int ySimulationPositionChange = UnitValueConverter.ToSimulationPosition(Mathf.Abs(positionChange.z));

            byte roundedFramesNeedToReachX = (byte)Mathf.Round(xSimulationPositionChange / 250);
            byte roundedFramesNeedToReachY = (byte)Mathf.Round(ySimulationPositionChange / 250);

            return(roundedFramesNeedToReachX > roundedFramesNeedToReachY ? roundedFramesNeedToReachX : roundedFramesNeedToReachY);
        }
コード例 #2
0
        public static float GetMaxFrameTranslation(Vector3 positionChange, byte frames)
        {
            int xSimulationPositionChangePerFrame = UnitValueConverter.ToSimulationPosition(Mathf.Abs(positionChange.x)) / frames;
            int ySimulationPositionChangePerFrame = UnitValueConverter.ToSimulationPosition(Mathf.Abs(positionChange.z)) / frames;

            float xTranslationPerFrame = xSimulationPositionChangePerFrame / 250;
            float yTranslationPerFrame = ySimulationPositionChangePerFrame / 250;

            return(xTranslationPerFrame > yTranslationPerFrame ? xTranslationPerFrame : yTranslationPerFrame);
        }