1234567891011121314151617181920212223242526272829303132333435363738 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using AIPagedLod;
- using System.Xml;
- using System;
- using System.IO;
- public class PagedLodUpdateController : MonoBehaviour
- {
- public static float mTranslateTreshold = 1.0f;
- public static float mRotateTreshold = 1.0f;
- public static float mZoomTreshold = 1.0f;
- public static bool mIsPagedLodUpdateEnable = true;
- void Awake()
- {
- #if !UNITY_WEBGL && !UNITY_ANDROID
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.Load(Application.streamingAssetsPath + "/PagedLodConfig/Config.xml");
- XmlElement cameraConfig = (XmlElement)xmlDoc.DocumentElement.GetElementsByTagName("CameraConfig")[0];
- mTranslateTreshold = float.Parse(cameraConfig.GetAttribute("TranslateTreshold"));
- mRotateTreshold = float.Parse(cameraConfig.GetAttribute("RotateTreshold"));
- mZoomTreshold = float.Parse(cameraConfig.GetAttribute("ZoomTreshold"));
- #endif
- }
- private void Update()
- {
- bool RotateEnabled = PlayerPrefs.GetInt("CameraRotating") == 0;
- bool ZoomEnabled = PlayerPrefs.GetInt("CameraZooming") == 0;
- bool TranslateEnable = PlayerPrefs.GetInt("CameraTranslating") == 0;
- mIsPagedLodUpdateEnable = RotateEnabled && ZoomEnabled && TranslateEnable;
- }
- public static bool IsUpdateEnabled()
- {
- return mIsPagedLodUpdateEnable;
- }
- }
|