Beispiel #1
0
        public void SetPosition(GameObject gameObject)
        {
            BaseInputInfo inputInfo = CurrentRecording.CurrentFrame.GetInputInfo(gameObject.name);

            if (inputInfo == null)
            {
                inputInfo = new PositionInputInfo();
            }
            PositionInputInfo positionInputInfo = (PositionInputInfo)inputInfo;

            positionInputInfo.Positon  = gameObject.transform.position;
            positionInputInfo.Rotation = gameObject.transform.rotation;
            CurrentRecording.CurrentFrame.AddInputInfo(gameObject.name, positionInputInfo);
        }
        /// <summary>
        /// Returns the platform appropriate axis for the given name.
        /// </summary>
        /// <param name="name">Input Name</param>
        /// <returns>Axis Value</returns>
        public float GetAxis(string name)
        {
            if (CurrentInputMode == RVInputMode.Playback)
            {
                StandaloneInputInfo inputInfo = CurrentRecording.HasCurrentFrame() ?
                                                (StandaloneInputInfo)CurrentRecording.CurrentFrame.GetInputInfo(name) : null;
                return(inputInfo == null ? 0.0f : inputInfo.AxisValue);
            }
            float axisValue = Input.GetAxis(name);

            if (CurrentInputMode == RVInputMode.Record)
            {
                BaseInputInfo inputInfo = CurrentRecording.CurrentFrame.GetInputInfo(name);
                if (inputInfo == null)
                {
                    inputInfo = new StandaloneInputInfo();
                }
                StandaloneInputInfo standaloneInputInfo = (StandaloneInputInfo)inputInfo;
                standaloneInputInfo.AxisValue = axisValue;
                CurrentRecording.CurrentFrame.AddInputInfo(name, standaloneInputInfo);
            }
            return(axisValue);
        }