internal static void UpdateInternal() { AssertIsSetup(); if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } currentTick++; UpdateCurrentTime(); var deltaTime = currentTime - lastUpdateTime; UpdateDeviceManagers(deltaTime); MenuWasPressed = false; UpdateDevices(deltaTime); CommitDevices(deltaTime); UpdateActiveDevice(); if (OnUpdate != null) { OnUpdate.Invoke(currentTick, deltaTime); } lastUpdateTime = currentTime; }
internal static void UpdateInternal() { AssertIsSetup(); if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } if (SuspendInBackground && !applicationIsFocused) { return; } currentTick++; UpdateCurrentTime(); var deltaTime = currentTime - lastUpdateTime; UpdateDeviceManagers(deltaTime); MenuWasPressed = false; UpdateDevices(deltaTime); CommitDevices(deltaTime); UpdateActiveDevice(); UpdatePlayerActionSets(deltaTime); if (OnUpdate != null) { OnUpdate.Invoke(currentTick, deltaTime); } lastUpdateTime = currentTime; }
public static void Setup() { if (isSetup) { return; } Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper(); initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; inputDeviceManagers.Clear(); Devices.Clear(); activeDevice = InputDevice.Null; isSetup = true; #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (enableXInput) { XInputDeviceManager.Enable(); } #endif AddDeviceManager(new UnityInputDeviceManager()); if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } }
void Update() { var currentScreenSize = GetCurrentScreenSize(); if (!isReady) { // This little hack is necessary because right after Unity starts up, // cameras don't seem to have a correct projection matrix until after // their first update or around that time. So we basically need to // wait until the end of the first frame before everything is quite ready. StartCoroutine(UpdateScreenSizeAtEndOfFrame()); UpdateScreenSize(currentScreenSize); isReady = true; return; } if (screenSize != currentScreenSize) { UpdateScreenSize(currentScreenSize); } if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } }
internal static bool SetupInternal() { if (IsSetup) { return(false); } #if !NETFX_CORE && !UNITY_WEBPLAYER && !UNITY_EDITOR_OSX && (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN) Platform = (Utility.GetWindowsVersion() + " " + SystemInfo.deviceModel).ToUpper(); #else Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper(); #endif initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; deviceManagers.Clear(); deviceManagerTable.Clear(); devices.Clear(); Devices = new ReadOnlyCollection <InputDevice>(devices); activeDevice = InputDevice.Null; IsSetup = true; #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (EnableXInput) { XInputDeviceManager.Enable(); } #endif #if UNITY_IOS if (EnableICade) { ICadeDeviceManager.Enable(); } #endif if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } var addUnityInputDeviceManager = true; #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR addUnityInputDeviceManager = false; #endif if (addUnityInputDeviceManager) { AddDeviceManager <UnityInputDeviceManager>(); } return(true); }
private void Start() { data = GameManager.Instance.savedPlayerData.enemy; maxHealth = data.maxHealth; health = maxHealth; nameText.text = data.name; GetComponent <SpriteRenderer>().sprite = data.art; OnSetup?.Invoke(maxHealth); }
public void Restart() { sfxBGM.Play(); inventory.energy.SetValue(10); inventory.health.SetValue(1); inventory.keyLrg.SetValue(0); inventory.keySml.SetValue(0); inventory.score.SetValue(0); OnSetup?.Invoke(); OnStart?.Invoke(); }
internal static void UpdateInternal() { AssertIsSetup(); if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } if (!enabled) { return; } if (SuspendInBackground && !applicationIsFocused) { return; } currentTick++; UpdateCurrentTime(); var deltaTime = currentTime - lastUpdateTime; MouseProvider.Update(); KeyboardProvider.Update(); UpdateDeviceManagers(deltaTime); CommandWasPressed = false; UpdateDevices(deltaTime); CommitDevices(deltaTime); var lastActiveDevice = ActiveDevice; UpdateActiveDevice(); UpdatePlayerActionSets(deltaTime); // We wait to trigger OnActiveDeviceChanged until after UpdatePlayerActionSets // so binding name changes will have updated, which is more intuitive. if (lastActiveDevice != ActiveDevice && OnActiveDeviceChanged != null) { OnActiveDeviceChanged.Invoke(ActiveDevice); } if (OnUpdate != null) { OnUpdate.Invoke(currentTick, deltaTime); } lastUpdateTime = currentTime; }
void Setup() { UpdateScreenSize(new Vector2(Screen.width, Screen.height)); CreateDevice(); CreateTouches(); if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } }
void Setup() { UpdateScreenSize(GetCurrentScreenSize()); CreateDevice(); CreateTouches(); if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } }
internal static void SetupInternal() { if (isSetup) { return; } Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper(); initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; inputDeviceManagers.Clear(); devices.Clear(); Devices = new ReadOnlyCollection <InputDevice>(devices); activeDevice = InputDevice.Null; isSetup = true; #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (enableXInput) { XInputDeviceManager.Enable(); } if (enablePS4Win) { PS4WinDeviceManager.Enable(); } #endif if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } var addUnityInputDeviceManager = true; #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR addUnityInputDeviceManager = false; #endif if (addUnityInputDeviceManager) { AddDeviceManager <UnityInputDeviceManager>(); } }
void Update() { if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } var currentScreenSize = new Vector2(Screen.width, Screen.height); if (screenSize != currentScreenSize) { UpdateScreenSize(currentScreenSize); } }
private void UpdateInternal() { AssertIsSetup(); if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } UpdateDeviceManagers(); CommitDeviceManagers(); UpdateActiveDevice(); if (OnUpdate != null) { OnUpdate.Invoke(); } }
private bool SetupInternal() { if (IsSetup) { return(false); } deviceManagers.Clear(); deviceManagerTable.Clear(); activeDevice = InputDevice.Null; IsSetup = true; if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } return(true); }
internal static void SetupInternal() { if (_isSetup) { return; } Platform = "{0} {1}".With(SystemInfo.operatingSystem, SystemInfo.deviceModel).ToUpper(); _initialTime = 0.0f; _currentTime = 0.0f; _lastUpdateTime = 0.0f; _currentTick = 0; DeviceManagers.Clear(); devices.Clear(); Devices = new ReadOnlyCollection <InputDevice>(devices); _activeDevice = InputDevice.Null; _isSetup = true; #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN if (EnableXInput) { XInputDeviceManager.Enable(); } #endif if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } #if !(UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR) AddDeviceManager <UnityInputDeviceManager>(); #endif }
internal static void UpdateInternal() { AssertIsSetup(); if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } currentTick++; UpdateCurrentTime(); var deltaTime = currentTime - lastUpdateTime; UpdateDeviceManagers(deltaTime); PreUpdateDevices(deltaTime); UpdateDevices(deltaTime); PostUpdateDevices(deltaTime); UpdateActiveDevice(); lastUpdateTime = currentTime; }
public static void Update() { AssertIsSetup(); if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } currentTick++; UpdateCurrentTime(); UpdateDeviceManagers(); UpdateDevices(); UpdateActiveDevice(); if (OnUpdate != null) { OnUpdate.Invoke(currentTick, currentTime - lastUpdateTime); } lastUpdateTime = currentTime; }
public static void Setup() { Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper(); initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; inputDeviceManagers.Clear(); Devices.Clear(); activeDevice = InputDevice.Null; isSetup = true; #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (enableXInput) { if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) { HideDevicesWithProfile(typeof(Xbox360WinProfile)); HideDevicesWithProfile(typeof(LogitechF710ModeXWinProfile)); InputManager.AddDeviceManager(new XInputDeviceManager()); } } #endif AddDeviceManager(new UnityInputDeviceManager()); if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } }
internal static bool SetupInternal() { if (IsSetup) { return(false); } #if !NETFX_CORE && !UNITY_WEBPLAYER && !UNITY_EDITOR_OSX && (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN) Platform = Utility.GetWindowsVersion().ToUpper(); #else Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper(); #endif enabled = true; initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; applicationIsFocused = true; deviceManagers.Clear(); deviceManagerTable.Clear(); devices.Clear(); Devices = devices.AsReadOnly(); activeDevice = InputDevice.Null; activeDevices.Clear(); ActiveDevices = activeDevices.AsReadOnly(); playerActionSets.Clear(); // TO DO: Can this move further down after the UnityInputDeviceManager is added, which is more intuitive? // Currently it's used to verify we're in or after setup for various functions that are // called during manager initialization. There should be a safer way... maybe add IsReset? IsSetup = true; var enableUnityInput = true; var nativeInputIsEnabled = EnableNativeInput && NativeInputDeviceManager.Enable(); if (nativeInputIsEnabled) { enableUnityInput = false; } #if ENABLE_WINMD_SUPPORT && !UNITY_XBOXONE && !UNITY_EDITOR if (UWPDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (EnableXInput && enableUnityInput) { XInputDeviceManager.Enable(); } #endif #if UNITY_IOS || UNITY_TVOS if (EnableICade) { ICadeDeviceManager.Enable(); } #endif #if UNITY_XBOXONE if (XboxOneInputDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_SWITCH if (NintendoSwitchInputDeviceManager.Enable()) { enableUnityInput = false; } #endif // TO DO: Can this move further down after the UnityInputDeviceManager is added, which is more intuitive? // Currently, it allows use of InputManager.HideDevicesWithProfile() to be called in OnSetup, which is possibly useful? if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR enableUnityInput = false; #endif if (enableUnityInput) { AddDeviceManager <UnityInputDeviceManager>(); } return(true); }
public override void Setup(IEntity entity) { OnSetup?.Invoke(entity); }
internal static bool SetupInternal() { if (IsSetup) { return(false); } Platform = Utility.GetPlatformName(); enabled = true; initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; applicationIsFocused = true; deviceManagers.Clear(); deviceManagerTable.Clear(); devices.Clear(); Devices = devices.AsReadOnly(); activeDevice = InputDevice.Null; activeDevices.Clear(); ActiveDevices = activeDevices.AsReadOnly(); playerActionSets.Clear(); MouseProvider = new UnityMouseProvider(); MouseProvider.Setup(); KeyboardProvider = new UnityKeyboardProvider(); KeyboardProvider.Setup(); // TODO: Can this move further down after the UnityInputDeviceManager is added, which is more intuitive? // Currently it's used to verify we're in or after setup for various functions that are // called during manager initialization. There should be a safer way... maybe add IsReset? IsSetup = true; var enableUnityInput = true; var nativeInputIsEnabled = EnableNativeInput && NativeInputDeviceManager.Enable(); if (nativeInputIsEnabled) { enableUnityInput = false; } #if ENABLE_WINMD_SUPPORT && !UNITY_XBOXONE && !UNITY_EDITOR if (UWPDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_XBOXONE if (XboxOneInputDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_GAMECORE if (GameCoreInputDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_SWITCH if (NintendoSwitchInputDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_STADIA if (StadiaInputDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN if (EnableXInput && enableUnityInput) { XInputDeviceManager.Enable(); } #endif #if UNITY_IOS || UNITY_TVOS if (EnableICade) { ICadeDeviceManager.Enable(); } #endif // TODO: Can this move further down after the UnityInputDeviceManager is added, which is more intuitive? // Currently, it allows use of InputManager.HideDevicesWithProfile() to be called in OnSetup, which is possibly useful? if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR enableUnityInput = false; #endif if (enableUnityInput) { #if INCONTROL_USE_NEW_UNITY_INPUT AddDeviceManager <NewUnityInputDeviceManager>(); #else AddDeviceManager <UnityInputDeviceManager>(); #endif } return(true); }
internal static bool SetupInternal() { if (IsSetup) { return(false); } #if !NETFX_CORE && !UNITY_WEBPLAYER && !UNITY_EDITOR_OSX && (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN) Platform = Utility.GetWindowsVersion().ToUpper(); #else Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper(); #endif enabled = true; initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; applicationIsFocused = true; deviceManagers.Clear(); deviceManagerTable.Clear(); devices.Clear(); Devices = new ReadOnlyCollection <InputDevice>(devices); activeDevice = InputDevice.Null; playerActionSets.Clear(); // TODO: Can this move further down along with the OnSetup callback? IsSetup = true; var enableUnityInput = true; var nativeInputIsEnabled = EnableNativeInput && NativeInputDeviceManager.Enable(); if (nativeInputIsEnabled) { enableUnityInput = false; } #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (EnableXInput && enableUnityInput) { XInputDeviceManager.Enable(); } #endif #if UNITY_IOS if (EnableICade) { ICadeDeviceManager.Enable(); } #endif #if UNITY_XBOXONE if (XboxOneInputDeviceManager.Enable()) { enableUnityInput = false; } #endif // TODO: Can this move further down after the UnityInputDeviceManager is added? // Currently, it allows use of InputManager.HideDevicesWithProfile() if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR enableUnityInput = false; #endif if (enableUnityInput) { AddDeviceManager <UnityInputDeviceManager>(); } return(true); }
public void Setup() { this.gameObject.SetActive(true); OnSetup?.Invoke(); }