public static int guiDepth = 0; // define a static gui depth variable in all other gui classes and use in OnGui() as shown ahead void Awake() { FPS_Player = this.gameObject; m_Player = FPS_Player.transform.GetComponent <vp_FPPlayerEventHandler>(); m_Input = FPS_Player.transform.GetComponent <vp_FPInput>(); isInPauseState = false; }
/// <summary> /// re-caches all of the standard UFPS local player components /// </summary> private static void RefreshPlayerComponents() { m_FPCamera = null; m_FPController = null; m_FPInput = null; m_FPDamageHandler = null; m_FPWeaponHandler = null; m_Inventory = null; m_Respawner = null; m_FPBodyAnimator = null; m_RagdollHandler = null; m_FootFXHandler = null; if (m_FPEventHandler == null) { return; } m_FPCamera = m_FPEventHandler.GetComponentInChildren <vp_FPCamera>(); m_FPController = m_FPEventHandler.GetComponentInChildren <vp_FPController>(); m_FPInput = m_FPEventHandler.GetComponentInChildren <vp_FPInput>(); m_FPDamageHandler = m_FPEventHandler.GetComponentInChildren <vp_FPPlayerDamageHandler>(); m_FPWeaponHandler = m_FPEventHandler.GetComponentInChildren <vp_FPWeaponHandler>(); m_Inventory = m_FPEventHandler.GetComponentInChildren <vp_PlayerInventory>(); m_Respawner = m_FPEventHandler.GetComponentInChildren <vp_PlayerRespawner>(); m_FPBodyAnimator = m_FPEventHandler.GetComponentInChildren <vp_FPBodyAnimator>(); m_RagdollHandler = m_FPEventHandler.GetComponentInChildren <vp_RagdollHandler>(); m_FootFXHandler = m_FPEventHandler.GetComponentInChildren <vp_PlayerFootFXHandler>(); }
private void Awake() { #if UltimateFPSIsPresent // Tag the GameObject as 'Player' if it is not already gameObject.tag = Tags.player; player = GetComponent <Player>(); // Assign the UFPS components, and report warnings if they are not present fpCamera = GetComponentInChildren <vp_FPCamera>(); fpController = GetComponentInChildren <vp_FPController>(); fpInput = GetComponentInChildren <vp_FPInput>(); fpPlayerEventHandler = GetComponentInChildren <vp_FPPlayerEventHandler>(); simpleHUD = GetComponentInChildren <vp_SimpleHUD>(); simpleCrosshair = GetComponentInChildren <vp_SimpleCrosshair>(); _audioListener = GetComponentInChildren <AudioListener>(); if (fpController == null) { ACDebug.LogWarning("Cannot find UFPS script 'vp_FPController' anywhere on '" + gameObject.name + "'."); } if (fpInput == null) { ACDebug.LogWarning("Cannot find UFPS script 'vp_FPInput' anywhere on '" + gameObject.name + "'."); } if (fpCamera == null) { ACDebug.LogWarning("Cannot find UFPS script 'vp_FPCamera' anywhere on '" + gameObject.name + "'."); } if (KickStarter.settingsManager != null && KickStarter.settingsManager.movementMethod != MovementMethod.FirstPerson) { ACDebug.Log("The Ultimate FPS integration script requires the Settings Manager's 'Movement method' is set to 'First Person'"); } #endif }
void Awake() { if (fpController == null) { fpController = GetComponentInChildren <vp_FPController>(); } if (fpCamera == null) { fpCamera = GetComponentInChildren <vp_FPCamera>(); } if (fpPlayerEventHandler == null) { fpPlayerEventHandler = GetComponentInChildren <vp_FPPlayerEventHandler>(); } if (fpInput == null) { fpInput = GetComponentInChildren <vp_FPInput>(); } if (fpHUD == null) { fpHUD = GetComponentInChildren <vp_SimpleHUD>(); } if (fpCrosshair == null) { fpCrosshair = GetComponentInChildren <vp_SimpleCrosshair>(); } }
void Awake() { if (fpController == null) fpController = GetComponentInChildren<vp_FPController>(); if (fpCamera == null) fpCamera = GetComponentInChildren<vp_FPCamera>(); if (fpPlayerEventHandler == null) fpPlayerEventHandler = GetComponentInChildren<vp_FPPlayerEventHandler>(); if (fpInput == null) fpInput = GetComponentInChildren<vp_FPInput>(); if (fpHUD == null) fpHUD = GetComponentInChildren<vp_SimpleHUD>(); if (fpCrosshair == null) fpCrosshair = GetComponentInChildren<vp_SimpleCrosshair>(); }
/// <summary> /// hooks up the FPSCamera object to the inspector target /// </summary> public void OnEnable() { m_Component = (vp_FPInput)target; if (m_Persister == null) m_Persister = new vp_ComponentPersister(); m_Persister.Component = m_Component; m_Persister.IsActive = true; if (m_Component.DefaultState == null) m_Component.RefreshDefaultState(); }
// Use this for initialization void Start() { /* Regular First Person Controller stuff */ //playerML = GameObject.FindGameObjectWithTag("Player").GetComponent<MouseLook>(); //cameraML = Camera.main.GetComponent<MouseLook>(); /* For Hero character controller */ //playerML = GameObject.FindGameObjectWithTag("Player").GetComponent<vp_FPInput>(); //crosshair = GameObject.FindGameObjectWithTag("Player").GetComponent<vp_SimpleCrosshair>(); playerML = player.GetComponent <vp_FPInput>(); crosshair = player.GetComponent <vp_SimpleCrosshair>(); oldVec = playerML.GetMouseLookSensitivity(); PauseGUI.SetActive(false); crosshair.SetPaused(false); newVec = new Vector2(0.0f, 0.0f); }
/// <summary> /// hooks up the FPSCamera object to the inspector target /// </summary> public void OnEnable() { m_Component = (vp_FPInput)target; if (m_Persister == null) { m_Persister = new vp_ComponentPersister(); } m_Persister.Component = m_Component; m_Persister.IsActive = true; if (m_Component.DefaultState == null) { m_Component.RefreshDefaultState(); } }
/// </summary> /// /// </summary> public vp_FPSDemoManager(GameObject player) { Player = player; Controller = Player.GetComponent<vp_FPController>(); Camera = Player.GetComponentInChildren<vp_FPCamera>(); WeaponHandler = Player.GetComponentInChildren<vp_FPWeaponHandler>(); PlayerEventHandler = (vp_FPPlayerEventHandler)Player.GetComponentInChildren(typeof(vp_FPPlayerEventHandler)); Input = Player.GetComponent<vp_FPInput>(); Earthquake = (vp_Earthquake)Component.FindObjectOfType(typeof(vp_Earthquake)); // on small screen resolutions the editor preview screenshot // panel is minimized by default, otherwise expanded if (Screen.width < 1024) EditorPreviewSectionExpanded = false; }
internal static void UpdateAll(vp_FPInput instance) { try { Reg.Update(instance.FPPlayer); foreach (Keybind keybind in KeybindRegistry.keybinds) { keybind.Update(instance.FPPlayer); } } catch (Exception ex) { Log.Write(ex); } }
private void Start() { #if !UltimateFPSIsPresent ACDebug.LogWarning("'UltimateFPSIsPresent' must be listed in your Unity Player Setting's 'Scripting define symbols' for AC's UFPS integration to work."); return; #else // Assign the UFPS components, and report warnings if they are not present fpCamera = GetComponentInChildren <vp_FPCamera>(); fpController = GetComponentInChildren <vp_FPController>(); fpInput = GetComponentInChildren <vp_FPInput>(); _audioListener = GetComponentInChildren <AudioListener>(); if (fpController == null) { ACDebug.LogWarning("Cannot find UFPS script 'vp_FPController' anywhere on '" + gameObject.name + "'."); } if (fpInput == null) { ACDebug.LogWarning("Cannot find UFPS script 'vp_FPInput' anywhere on '" + gameObject.name + "'."); } if (fpCamera == null) { ACDebug.LogWarning("Cannot find UFPS script 'vp_FPCamera' anywhere on '" + gameObject.name + "'."); } if (KickStarter.settingsManager != null && KickStarter.settingsManager.movementMethod != MovementMethod.FirstPerson) { ACDebug.Log("The Ultimate FPS integration script requires the Settings Manager's 'Movement method' is set to 'First Person'"); } // Tell the AC Player component that we'l be controlling movement/rotation manually during Cutscenes player = GetComponent <Player>(); player.FirstPersonCamera = fpCamera.transform; player.SetAnimEngine(AnimationEngine.Custom); player.motionControl = MotionControl.Manual; // Assign a short delay whenever we load a saved game, to prevent firing when click if (KickStarter.saveSystem) { KickStarter.saveSystem.SetGameplayReturnTime(0.1f); } // Fixes gun sounds from not always playing AudioListener.pause = false; #endif }
/// </summary> /// /// </summary> public vp_FPSDemoManager(GameObject player) { Player = player; Controller = Player.GetComponent <vp_FPController>(); Camera = Player.GetComponentInChildren <vp_FPCamera>(); WeaponHandler = Player.GetComponentInChildren <vp_WeaponHandler>(); PlayerEventHandler = (vp_FPPlayerEventHandler)Player.GetComponentInChildren(typeof(vp_FPPlayerEventHandler)); Input = Player.GetComponent <vp_FPInput>(); Earthquake = (vp_FPEarthquake)Component.FindObjectOfType(typeof(vp_FPEarthquake)); // on small screen resolutions the editor preview screenshot // panel is minimized by default, otherwise expanded if (Screen.width < 1024) { EditorPreviewSectionExpanded = false; } }
// Use this for initialization void Start() { input = GetComponent <vp_FPInput>(); }
protected virtual void Awake() { vp_FPInput.cs = this; this.Player = (vp_FPPlayerEventHandler)base.transform.root.GetComponentInChildren(typeof(vp_FPPlayerEventHandler)); this.m_FPCamera = base.GetComponentInChildren <vp_FPCamera>(); }
private void Start() { #if !UltimateFPSIsPresent ACDebug.LogWarning ("'UltimateFPSIsPresent' must be listed in your Unity Player Setting's 'Scripting define symbols' for AC's UFPS integration to work."); return; #else // Assign the UFPS components, and report warnings if they are not present fpCamera = GetComponentInChildren <vp_FPCamera>(); fpController = GetComponentInChildren <vp_FPController>(); fpInput = GetComponentInChildren <vp_FPInput>(); _audioListener = GetComponentInChildren <AudioListener>(); if (fpController == null) { ACDebug.LogWarning ("Cannot find UFPS script 'vp_FPController' anywhere on '" + gameObject.name + "'."); } if (fpInput == null) { ACDebug.LogWarning ("Cannot find UFPS script 'vp_FPInput' anywhere on '" + gameObject.name + "'."); } if (fpCamera == null) { ACDebug.LogWarning ("Cannot find UFPS script 'vp_FPCamera' anywhere on '" + gameObject.name + "'."); } if (KickStarter.settingsManager != null && KickStarter.settingsManager.movementMethod != MovementMethod.FirstPerson) { ACDebug.Log ("The Ultimate FPS integration script requires the Settings Manager's 'Movement method' is set to 'First Person'"); } // Tell the AC Player component that we'l be controlling movement/rotation manually during Cutscenes player = GetComponent <Player>(); player.FirstPersonCamera = fpCamera.transform; player.SetAnimEngine (AnimationEngine.Custom); player.motionControl = MotionControl.Manual; // Assign a short delay whenever we load a saved game, to prevent firing when click if (KickStarter.saveSystem) { KickStarter.saveSystem.SetGameplayReturnTime (0.1f); } // Fixes gun sounds from not always playing AudioListener.pause = false; #endif }