// -------------------------------------------------------------------------------------------------------------------------- // void Update() { // Get elapsed time bool addAnimation = false; if (m_SkipAddTime == false) { addAnimation = m_TimeHistory.AddTime(Time.deltaTime); } m_SkipAddTime = false; // Change playing mode if (Input.GetKeyDown(KeyCode.Space) == true) { // Clear Animation objects m_ControlSSP.ClearAnimation(); // When you comment out this line, you can switch playing modes while leaving animation objects. // Switch GameObject for running of "SS6Player" and "Unity-Native" m_playerNo = (PlayerNoKind)(((int)m_playerNo + 1) % (int)PlayerNoKind.MAX); SwitchSSPlayer(); // Clear measurement history m_TimeHistory.Clear(); } // Measurement per time range if (addAnimation == true) { if (m_TimeHistory.CheckTime(m_FrameTime) == true) { m_ControlSSP.AddAnimation(); // in frame time (increase by 1 animation-object) } else { m_ControlSSP.DelAnimation(); // out of frame time (decreases by 1 animation-object) } // 計測ワークを再初期化 m_TimeHistory.Clear(); // Since there is overhead for instantiate and destroy, // frames with increased or decreased (animation-object) are not included in the measurement. m_SkipAddTime = true; } }
// -------------------------------------------------------------------------------------------------------------------------- // void Start() { // Set Setting m_AnimetionSettingData.Initialize(); m_AnimetionSettingData.SetParam(AnimationSettingDataType.LineCount, (float)AnimationLineCount); m_AnimetionSettingData.SetParam(AnimationSettingDataType.StartX, (float)AnimationStartX); m_AnimetionSettingData.SetParam(AnimationSettingDataType.StartY, (float)AnimationStartY); m_AnimetionSettingData.SetParam(AnimationSettingDataType.AligmentX, (float)AnimationAlignmentX); m_AnimetionSettingData.SetParam(AnimationSettingDataType.AligmentY, (float)AnimationAlignmentY); m_AnimetionSettingData.SetParam(AnimationSettingDataType.ScaleX, (float)AnimationScaleX); m_AnimetionSettingData.SetParam(AnimationSettingDataType.ScaleY, (float)AnimationScaleY); // Get Animation-Control Components // SS6Player for Unity if (GameObjectActiveSS6P != null) { m_SS6P = GameObjectActiveSS6P.GetComponent <Script_Sample_Benchmark_SS6PlayerPlay>(); m_SS6P.Initialize(m_AnimetionSettingData); } else { m_SS6P = null; } // SS6Player for Unity (Unity Native) if (GameObjectActiveSS6PUN != null) { m_SS6PUN = GameObjectActiveSS6PUN.GetComponent <Script_Sample_Benchmark_UnityNativePlay>(); m_SS6PUN.Initialize(m_AnimetionSettingData); } else { m_SS6PUN = null; } // Set Application's frame rate int frameRate = 60; switch (FrameRate) { case FrameRateKind.FPS_60: frameRate = 60; break; case FrameRateKind.FPS_30: frameRate = 30; break; default: break; } Application.targetFrameRate = frameRate; m_FrameTime = 1.0f / (float)frameRate; // Initialize measurement history m_TimeHistory.Initialize(frameRate / 2); // 0.5 sec. per measurement m_SkipAddTime = true; // Initialize playing mode m_playerNo = PlayerNoKind.SS6P; SwitchSSPlayer(); }