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> /// /// </summary> protected virtual void Awake() { m_Player = GetComponent<vp_FPPlayerEventHandler>(); // cache the player event handler m_Camera = GetComponentInChildren<vp_FPCamera>(); // cache vp_FPCamera }
/// <summary> /// /// </summary> void Start() { m_FPSCamera = (vp_FPCamera)Component.FindObjectOfType(typeof(vp_FPCamera)); m_Demo = new vp_FPSDemoManager(Player); m_Demo.CurrentFullScreenFadeTime = Time.time; m_Demo.DrawCrosshair = false; m_Demo.Input.MouseCursorZones = new Rect[3]; m_Demo.Input.MouseCursorZones[0] = new Rect((Screen.width * 0.5f) - 370, 40, 80, 80); m_Demo.Input.MouseCursorZones[1] = new Rect((Screen.width * 0.5f) + 290, 40, 80, 80); m_Demo.Input.MouseCursorZones[2] = new Rect(0, 0, 150, Screen.height); Screen.lockCursor = false; m_LookPoints[1] = new Vector3(129.3f, 122, -186); m_LookPoints[2] = new Vector3(129.3f, 85, -186); m_LookPoints[3] = new Vector3(147, 85, -186); m_LookPoints[4] = new Vector3(12, 85, -214); m_LookPoints[5] = new Vector3(129, 122, -118); m_LookPoints[6] = new Vector3(125.175f, 106.1071f, -97.58212f); m_LookPoints[7] = new Vector3(119.6f, 104.2f, -89.1f); m_LookPoints[8] = new Vector3(129, 112, -150); // prevent regular event handler weapon switching events m_Demo.PlayerEventHandler.SetWeapon.Disallow(10000000); m_Demo.PlayerEventHandler.SetPrevWeapon.Try = delegate() { return(false); }; m_Demo.PlayerEventHandler.SetNextWeapon.Try = delegate() { return(false); }; // manually register our fallimpact method with the player event handler // NOTE: this is not the typical event handler workflow. see the manual // event handler chapter for more info m_Demo.PlayerEventHandler.FallImpact.Register(this, "FallImpact", 0); }
/// <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>(); }
protected AudioClip m_LastPlayedSound = null; // used to make sure we don't place the same sound twice in a row /// <summary> /// cache all the necessary properties here /// </summary> protected virtual void Awake() { m_Player = GameObject.FindObjectOfType(typeof(vp_FPPlayerEventHandler)) as vp_FPPlayerEventHandler; m_Camera = GameObject.FindObjectOfType(typeof(vp_FPCamera)) as vp_FPCamera; m_Controller = GameObject.FindObjectOfType(typeof(vp_FPController)) as vp_FPController; m_Audio = gameObject.AddComponent <AudioSource>(); // add a new audio source for this class to use }
protected vp_UIManager m_Manager = null; // cached uimanager /// <summary> /// /// </summary> protected virtual void Awake() { m_Manager = transform.root.GetComponentInChildren <vp_UIManager>(); m_Camera = m_Manager.Player.GetComponentInChildren <vp_FPCamera>(); SetObjectPositions(); }
protected override void Start() { base.Start(); this.m_Controller = (vp_FPController)base.Root.GetComponent(typeof(vp_FPController)); this.m_Camera = (vp_FPCamera)base.Root.GetComponentInChildren(typeof(vp_FPCamera)); this.m_Weapon = (vp_FPWeapon)base.Transform.GetComponent(typeof(vp_FPWeapon)); }
protected List<Vector3> m_ObjectScales = new List<Vector3>(); // cached list of swayable objects position's #endregion Fields #region Methods /// <summary> /// /// </summary> protected virtual void Awake() { m_Manager = transform.root.GetComponentInChildren<vp_UIManager>(); m_Camera = m_Manager.Player.GetComponentInChildren<vp_FPCamera>(); SetObjectPositions(); }
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 }
protected AudioClip m_LastPlayedSound = null; // used to make sure we don't place the same sound twice in a row /// <summary> /// cache all the necessary properties here /// </summary> protected virtual void Awake() { m_Player = transform.root.GetComponentInChildren <vp_FPPlayerEventHandler>(); m_Camera = transform.root.GetComponentInChildren <vp_FPCamera>(); m_Controller = transform.root.GetComponentInChildren <vp_FPController>(); m_Audio = gameObject.AddComponent <AudioSource>(); // add a new audio source for this class to use }
/// <summary> /// /// </summary> protected void InitWeaponLists() { // first off, always store all weapons contained under our main FPS camera (if any) List <vp_Weapon> camWeapons = null; vp_FPCamera camera = transform.GetComponentInChildren <vp_FPCamera>(); if (camera != null) { camWeapons = GetWeaponList(Camera.main.transform); if ((camWeapons != null) && (camWeapons.Count > 0)) { m_WeaponLists.Add(camWeapons); } } List <vp_Weapon> allWeapons = new List <vp_Weapon>(transform.GetComponentsInChildren <vp_Weapon>()); // if the camera weapons were all the weapons we have, return if ((camWeapons != null) && (camWeapons.Count == allWeapons.Count)) { Weapons = m_WeaponLists[0]; return; } // identify every unique gameobject that holds weapons as direct children List <Transform> weaponContainers = new List <Transform>(); foreach (vp_Weapon w in allWeapons) { if ((camera != null) && camWeapons.Contains(w)) { continue; } if (!weaponContainers.Contains(w.Parent)) { weaponContainers.Add(w.Parent); } } // create one weapon list for every container found foreach (Transform t in weaponContainers) { List <vp_Weapon> weapons = GetWeaponList(t); DeactivateAll(weapons); m_WeaponLists.Add(weapons); } // abort and disable weapon handler in case no weapons were found if (m_WeaponLists.Count < 1) { Debug.LogError("Error (" + this + ") WeaponHandler found no weapons in its hierarchy. Disabling self."); enabled = false; return; } // start out with the first weapon list by default. on a 1st person // player, this would typically be the weapons stored under the camera Weapons = m_WeaponLists[0]; }
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 OnTriggerExit(Collider col) { if ((playerLayer.value & 1 << col.gameObject.layer) == 0) { return; } m_camera = col.gameObject.GetComponentInChildren <vp_FPCamera>(); TurnOff(); }
protected AudioClip m_LastPlayedSound = null; // used to make sure we don't place the same sound twice in a row /// <summary> /// cache all the necessary properties here /// </summary> protected virtual void Awake() { m_Player = transform.root.GetComponentInChildren<vp_FPPlayerEventHandler>(); m_Camera = transform.root.GetComponentInChildren<vp_FPCamera>(); m_Controller = transform.root.GetComponentInChildren<vp_FPController>(); m_Audio = gameObject.AddComponent<AudioSource>(); // add a new audio source for this class to use }
//On awake sets the values of the variables to point to the right objects. protected virtual void Awake() { Player = GameObject.FindObjectOfType(typeof(vp_FPPlayerEventHandler)) as vp_FPPlayerEventHandler; cross = GameObject.FindObjectOfType(typeof(vp_SimpleCrosshair)) as vp_SimpleCrosshair; Gun = GameObject.FindObjectOfType(typeof(vp_FPWeapon)) as vp_FPWeapon; camera = GameObject.FindObjectOfType(typeof(vp_FPCamera)) as vp_FPCamera; myCam = camera.GetComponent <Camera>(); BaseFOV = camera.RenderingFieldOfView; //Replaces the value of BaseFOV to whatever the actual Base FOV is. BaseShake = camera.ShakeSpeed; //Does the same to the base shake value. }
//On awake sets the values of the variables to point to the right objects. protected virtual void Awake() { Player = GameObject.FindObjectOfType(typeof(vp_FPPlayerEventHandler)) as vp_FPPlayerEventHandler; cross = GameObject.FindObjectOfType(typeof(vp_SimpleCrosshair)) as vp_SimpleCrosshair; Gun = GameObject.FindObjectOfType(typeof(vp_FPWeapon)) as vp_FPWeapon; camera = GameObject.FindObjectOfType(typeof(vp_FPCamera)) as vp_FPCamera; myCam=camera.GetComponent<Camera>(); BaseFOV=camera.RenderingFieldOfView;//Replaces the value of BaseFOV to whatever the actual Base FOV is. BaseShake=camera.ShakeSpeed;//Does the same to the base shake value. }
void Start() { barLength = Screen.width / 8; weaponScript = fpsCamera.GetComponent <vp_FPCamera> (); normalShakeSpeed = weaponScript.ShakeSpeed; normalShakeAmplitude = weaponScript.ShakeAmplitude; previousHealth = currentHealth; LOWEST_HEALTH_MARGIN = ACCURACY_DECREASE_FACTOR * GUN_AMPLITUDE_STEP; ACCURACY_INCREASE_FACTOR = 2 * ACCURACY_DECREASE_FACTOR; }
/// <summary> /// /// </summary> protected override void Awake() { base.Awake(); m_FPSCamera = transform.root.GetComponentInChildren <vp_FPCamera>(); m_OperatorTransform = m_FPSCamera.transform; // reset the next allowed fire time m_NextAllowedFireTime = Time.time; ProjectileSpawnDelay = Mathf.Min(ProjectileSpawnDelay, (ProjectileFiringRate - 0.1f)); }
protected AudioClip m_LastPlayedSound = null; // used to make sure we don't place the same sound twice in a row /// <summary> /// cache all the necessary properties here /// </summary> protected virtual void Awake() { Debug.LogWarning("Warning (" + this + ") This component is obsolete! please use the new vp_PlayerFootFXHandler component along with a scene vp_SurfaceManager instead."); m_Player = transform.root.GetComponentInChildren <vp_FPPlayerEventHandler>(); m_Camera = transform.root.GetComponentInChildren <vp_FPCamera>(); m_Controller = transform.root.GetComponentInChildren <vp_FPController>(); m_Audio = transform.root.GetComponentInChildren <AudioSource>(); if (m_Audio == null) { m_Audio = gameObject.AddComponent <AudioSource>(); } }
protected override void Awake() { base.Awake(); this.m_FPSCamera = base.transform.root.GetComponentInChildren <vp_FPCamera>(); this.m_OperatorTransform = this.m_FPSCamera.transform; this.m_NextAllowedFireTime = Time.time; this.ProjectileSpawnDelay = Mathf.Min(this.ProjectileSpawnDelay, this.ProjectileFiringRate - 0.1f); this.as_dryfire = base.Parent.GetComponent <AudioSource>(); if (this.sndSoundDryFire == null) { this.sndSoundDryFire = SND.GetSoundByName(this.SoundDryFire); } }
public void PostAwake() { C4.checkTime = Time.realtimeSinceStartup; C4.trPlayer = GameObject.Find("LocalPlayer").transform; C4.placeBomb = ContentLoader_.LoadGameObject("c4_place"); C4.plantStartSound = SND.GetSoundByName("c4_plant"); C4.showDiffuseBar = false; C4.sector = new C4.PlantSector[2]; C4.plant = new List <C4.PlantSector> [2]; C4.plant[0] = new List <C4.PlantSector>(); C4.plant[1] = new List <C4.PlantSector>(); this.csCamera = (vp_FPCamera)UnityEngine.Object.FindObjectOfType(typeof(vp_FPCamera)); this.csController = (vp_FPController)UnityEngine.Object.FindObjectOfType(typeof(vp_FPController)); }
/// <summary> /// /// </summary> void Start() { m_FPSCamera = (vp_FPCamera)Component.FindObjectOfType(typeof(vp_FPCamera)); m_Demo = new vp_FPSDemoManager(PlayerGameObject); m_Demo.CurrentFullScreenFadeTime = Time.time; m_Demo.DrawCrosshair = false; m_Demo.FadeGUIOnCursorLock = false; m_Demo.Input.MouseCursorZones = new Rect[2]; m_Demo.Input.MouseCursorZones[0] = new Rect((Screen.width * 0.5f) - 370, 40, 80, 80); m_Demo.Input.MouseCursorZones[1] = new Rect((Screen.width * 0.5f) + 290, 40, 80, 80); Screen.lockCursor = false; }
/// <summary> /// hooks up the FPSCamera object to the inspector target /// </summary> public virtual void OnEnable() { m_Component = (vp_FPCamera)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> protected override void Awake() { base.Awake(); m_FPSCamera = transform.root.GetComponentInChildren<vp_FPCamera>(); m_OperatorTransform = m_FPSCamera.transform; // reset the next allowed fire time m_NextAllowedFireTime = Time.time; ProjectileSpawnDelay = Mathf.Min(ProjectileSpawnDelay, (ProjectileFiringRate - 0.1f)); }
/// </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; }
/// <summary> /// hooks up the FPSCamera object to the inspector target /// </summary> public virtual void OnEnable() { m_Component = (vp_FPCamera)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(); } }
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; } }
/// <summary> /// /// </summary> protected override void Awake() { base.Awake(); m_FPCamera = transform.root.GetComponentInChildren<vp_FPCamera>(); if (m_ProjectileSpawnPoint == null) m_ProjectileSpawnPoint = m_FPCamera.gameObject; m_ProjectileDefaultSpawnpoint = m_ProjectileSpawnPoint; // reset the next allowed fire time m_NextAllowedFireTime = Time.time; ProjectileSpawnDelay = Mathf.Min(ProjectileSpawnDelay, (ProjectileFiringRate - 0.1f)); }
protected override void Awake() { vp_FPCamera.cs = this; base.Awake(); this.FPController = base.Root.GetComponent <vp_FPController>(); this.m_InitialRotation = new Vector2(base.Transform.eulerAngles.y, base.Transform.eulerAngles.x); base.Parent.gameObject.layer = 30; foreach (Transform transform in base.Parent) { transform.gameObject.layer = 30; } base.GetComponent <Camera>().cullingMask &= 1056964607; base.GetComponent <Camera>().depth = 0f; this.weaponCam = null; foreach (Transform transform2 in base.Transform) { this.weaponCam = (Camera)transform2.GetComponent(typeof(Camera)); if (this.weaponCam != null) { this.weaponCam.transform.localPosition = Vector3.zero; this.weaponCam.transform.localEulerAngles = Vector3.zero; this.weaponCam.clearFlags = CameraClearFlags.Depth; this.weaponCam.cullingMask = -2147483648; this.weaponCam.depth = 1f; this.weaponCam.farClipPlane = 100f; this.weaponCam.nearClipPlane = 0.01f; this.weaponCam.fov = 60f; vp_FPCamera.dof = this.weaponCam.GetComponent <DepthOfField>(); break; } } this.m_PositionSpring = new vp_Spring(base.Transform, vp_Spring.UpdateMode.Position, false); this.m_PositionSpring.MinVelocity = 1E-05f; this.m_PositionSpring.RestState = this.PositionOffset; this.m_PositionSpring2 = new vp_Spring(base.Transform, vp_Spring.UpdateMode.PositionAdditive, false); this.m_PositionSpring2.MinVelocity = 1E-05f; this.m_RotationSpring = new vp_Spring(base.Transform, vp_Spring.UpdateMode.RotationAdditive, false); this.m_RotationSpring.MinVelocity = 1E-05f; this.cameraFlashFX = GameObject.Find("WeaponCamera/FlashFX"); this.matFlashFX = this.cameraFlashFX.GetComponent <MeshRenderer>().material; this.matFlashFX.color = Color.white; this.SetFlashFX(0f, 3.5f); }
static void AddWeaponSwitcher() { Undo.RegisterSceneUndo("Create Weapon Switcher"); GameObject switcherGO = new GameObject("Weapon Switcher"); switcherGO.MakeChild(); GameObject background = new GameObject("Background", typeof(UISprite)); background.MakeChild(switcherGO.transform); GameObject panel = new GameObject("Panel", typeof(UIPanel)); panel.MakeChild(switcherGO.transform); GameObject scroller = new GameObject("WeaponScroller"); scroller.MakeChild(panel.transform); // get player fp camera vp_FPCamera fpCamera = FindObjectOfType(typeof(vp_FPCamera)) as vp_FPCamera; if (fpCamera) { foreach (Transform t in fpCamera.transform) { if (t.GetComponent <Camera>()) { continue; } GameObject go = new GameObject(t.name, typeof(UISprite)); go.MakeChild(scroller.transform); } } vp_UITouchWeaponSwitcher switcher = switcherGO.AddComponent <vp_UITouchWeaponSwitcher>(); switcher.WeaponScroller = scroller.transform; Selection.activeGameObject = switcherGO; }
static void AddWeaponSwitcher() { Undo.RegisterSceneUndo("Create Weapon Switcher"); GameObject switcherGO = new GameObject("Weapon Switcher"); switcherGO.MakeChild(); GameObject background = new GameObject("Background", typeof(MeshFilter), typeof(MeshRenderer)); background.MakeChild(switcherGO.transform); SetupRenderer(background); GameObject scroller = new GameObject("WeaponScroller"); scroller.MakeChild(switcherGO.transform); // get player fp camera vp_FPCamera fpCamera = FindObjectOfType(typeof(vp_FPCamera)) as vp_FPCamera; if (fpCamera) { foreach (Transform t in fpCamera.transform) { if (t.GetComponent <Camera>()) { continue; } GameObject go = new GameObject(t.name, typeof(MeshFilter), typeof(MeshRenderer)); go.MakeChild(scroller.transform); go.transform.position = new Vector3(0, 0, -5); SetupRenderer(go); } } vp_UITouchWeaponSwitcher switcher = switcherGO.AddComponent <vp_UITouchWeaponSwitcher>(); switcher.WeaponScroller = scroller.transform; Selection.activeGameObject = switcherGO; }
/// <summary> /// /// </summary> void Start() { if (PlayerGameObject == null) { vp_Utility.Activate(gameObject, false); Debug.LogWarning("Warning (" + this + ") No player gameobject assigned. Disabling demo."); return; } m_FPSCamera = (vp_FPCamera)Component.FindObjectOfType(typeof(vp_FPCamera)); m_Demo = new vp_FPSDemoManager(PlayerGameObject); m_Demo.CurrentFullScreenFadeTime = Time.time; m_Demo.DrawCrosshair = false; m_Demo.FadeGUIOnCursorLock = false; m_Demo.Input.MouseCursorZones = new Rect[2]; m_Demo.Input.MouseCursorZones[0] = new Rect((Screen.width * 0.5f) - 370, 40, 80, 80); m_Demo.Input.MouseCursorZones[1] = new Rect((Screen.width * 0.5f) + 290, 40, 80, 80); vp_Utility.LockCursor = false; }
/// <summary> /// /// </summary> public static Component GetFPCameraChildComponent(System.Type type, string name) { vp_FPCamera camera = GameObject.FindObjectOfType <vp_FPCamera>(); if (camera == null) { EditorUtility.DisplayDialog("Failed to find vp_FPCamera", "Make sure your scene has a gameobject with a vp_FPCamera component on it. ", "OK"); return(null); } foreach (Component c in camera.GetComponentsInChildren(type, true)) { if (c.name == name) { return(c); } } EditorUtility.DisplayDialog("Failed to find a matching " + type.Name, "Make sure the FPS camera object has a child gameobject with the exact name of \"" + name + "\", and that it has a " + type.Name + " component on it. ", "OK"); return(null); }
//Make contents of the window private void AssistWindowContent(int windowID) { if (GUI.Button(new Rect(10, 20, 100, 20), "Refresh Cam")) { cam = Camera.main; fpCam = FindObjectOfType <vp_FPCamera>(); } if (GUI.Button(new Rect(10, 50, 100, 20), "Move Mouse")) { MoveMouse(Screen.width / 2, Screen.height / 2); } if (GUI.Button(new Rect(10, 80, 100, 20), "Show DebugMsg")) { showDebugMsg = !showDebugMsg; } aimSpeed = int.Parse(GUI.TextField(new Rect(10, 110, 100, 20), aimSpeed.ToString())); // Make the background the dragging area GUI.DragWindow(); }
/// <summary> /// /// </summary> protected virtual void Awake() { Player = (vp_FPPlayerEventHandler)transform.root.GetComponentInChildren(typeof(vp_FPPlayerEventHandler)); m_FPCamera = 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 }
void Awake() { bridge = GetComponent<FPPlayerLuaBridge>(); fpController = GetComponentInChildren<vp_FPController>(); fpCamera = GetComponentInChildren<vp_FPCamera>(); }
private void ParsingCommand(string cmd) { this.AddLogString(cmd); this.inputstore = cmd; string[] array = cmd.Split(new char[] { ' ' }); if (array[0] == "map") { if (array.Length != 2) { return; } MapLoader mapLoader = (MapLoader)UnityEngine.Object.FindObjectOfType(typeof(MapLoader)); PlayerPrefs.SetInt("localplay", 1); mapLoader.Load(array[1]); } else if (array[0] == "devmap") { if (array.Length != 2) { return; } MapLoader mapLoader2 = (MapLoader)UnityEngine.Object.FindObjectOfType(typeof(MapLoader)); PlayerPrefs.SetInt("localplay", 2); mapLoader2.DevLoad(array[1]); } else if (array[0] == "team") { if (array.Length != 3) { return; } int num = 0; int num2 = 0; if (!int.TryParse(array[1], out num)) { return; } if (!int.TryParse(array[2], out num2)) { return; } if (num < 0 || num >= 2) { return; } if (num2 < 0 || num2 >= 8) { return; } UnityEngine.Object[] array2 = UnityEngine.Object.FindObjectsOfType(typeof(Spawn)); List <Spawn> list = new List <Spawn>(); List <Spawn> list2 = new List <Spawn>(); UnityEngine.Object[] array3 = array2; for (int i = 0; i < array3.Length; i++) { Spawn spawn = (Spawn)array3[i]; if (spawn.Team == 0) { list.Add(spawn); } else if (spawn.Team == 1) { list2.Add(spawn); } } GameObject gameObject = null; if (num == 0) { if (num2 >= list.Count) { return; } gameObject = list[num2].gameObject; } else if (num == 1) { if (num2 >= list2.Count) { return; } gameObject = list2[num2].gameObject; } MonoBehaviour.print("spawn"); GameObject gameObject2 = GameObject.Find("LocalPlayer"); vp_FPCamera vp_FPCamera = (vp_FPCamera)UnityEngine.Object.FindObjectOfType(typeof(vp_FPCamera)); gameObject2.transform.position = gameObject.transform.position; vp_FPCamera.SetRotation(new Vector2(0f, gameObject.transform.eulerAngles.y), true, true); } else if (array[0] == "sky") { if (array.Length != 2) { return; } } else if (array[0] == "sun_shadowbias" || array[0] == "sun_shadows") { if (array.Length != 2) { return; } UnityEngine.Object[] array4 = UnityEngine.Object.FindObjectsOfType(typeof(Light)); Light light = null; UnityEngine.Object[] array5 = array4; for (int j = 0; j < array5.Length; j++) { Light light2 = (Light)array5[j]; if (light2.type == LightType.Directional) { light = light2; break; } } if (light == null) { return; } if (array[0] == "sun_shadowbias") { float shadowBias = 0f; if (!float.TryParse(array[1], out shadowBias)) { return; } light.shadowBias = shadowBias; } if (array[0] == "sun_shadows") { int num3 = 0; if (!int.TryParse(array[1], out num3)) { return; } switch (num3) { case 0: light.shadows = LightShadows.None; break; case 1: light.shadows = LightShadows.Hard; break; case 2: light.shadows = LightShadows.Soft; break; } } } if (array[0] == "shadow_cascades") { if (array.Length != 2) { return; } int num4 = 0; if (!int.TryParse(array[1], out num4)) { return; } switch (num4) { case 0: QualitySettings.shadowCascades = 0; break; case 1: QualitySettings.shadowCascades = 2; break; case 2: QualitySettings.shadowCascades = 4; break; } } if (array[0] == "shadow_distance") { if (array.Length != 2) { return; } int num5 = 0; if (!int.TryParse(array[1], out num5)) { return; } QualitySettings.shadowDistance = (float)num5; } if (array[0] == "shadow_projection") { if (array.Length != 2) { return; } int num6 = 0; if (!int.TryParse(array[1], out num6)) { return; } int num7 = num6; if (num7 != 0) { if (num7 == 1) { QualitySettings.shadowProjection = ShadowProjection.StableFit; } } else { QualitySettings.shadowProjection = ShadowProjection.CloseFit; } } if (array[0] == "fx_ssao") { if (array.Length != 2) { return; } if (global::Console.ssao == null) { global::Console.ssao = (ScreenSpaceAmbientOcclusion)UnityEngine.Object.FindObjectOfType(typeof(ScreenSpaceAmbientOcclusion)); } if (global::Console.ssao == null) { return; } int num8 = 0; if (!int.TryParse(array[1], out num8)) { return; } if (num8 > 0) { global::Console.ssao.enabled = true; } else { global::Console.ssao.enabled = false; } } if (array[0] == "fx_sharpness") { if (array.Length != 2) { return; } if (global::Console.sharpness == null) { global::Console.sharpness = (ContrastEnhance)UnityEngine.Object.FindObjectOfType(typeof(ContrastEnhance)); } if (global::Console.sharpness == null) { return; } int num9 = 0; if (!int.TryParse(array[1], out num9)) { return; } if (num9 > 0) { global::Console.sharpness.enabled = true; } else { global::Console.sharpness.enabled = false; } } if (array[0] == "fx_noise") { if (array.Length != 2) { return; } if (global::Console.noise == null) { global::Console.noise = (NoiseAndGrain)UnityEngine.Object.FindObjectOfType(typeof(NoiseAndGrain)); } if (global::Console.noise == null) { return; } int num10 = 0; if (!int.TryParse(array[1], out num10)) { return; } if (num10 > 0) { global::Console.noise.enabled = true; } else { global::Console.noise.enabled = false; } } if (array[0] == "fx_tone") { if (array.Length != 2) { return; } if (global::Console.tone == null) { global::Console.tone = (Tonemapping)UnityEngine.Object.FindObjectOfType(typeof(Tonemapping)); } if (global::Console.tone == null) { return; } int num11 = 0; if (!int.TryParse(array[1], out num11)) { return; } if (num11 > 0) { global::Console.tone.enabled = true; } else { global::Console.tone.enabled = false; } } if (array[0] == "fx_vig") { if (array.Length != 2) { return; } if (global::Console.vig == null) { global::Console.vig = (VignetteAndChromaticAberration)UnityEngine.Object.FindObjectOfType(typeof(VignetteAndChromaticAberration)); } if (global::Console.vig == null) { return; } int num12 = 0; if (!int.TryParse(array[1], out num12)) { return; } if (num12 > 0) { global::Console.vig.enabled = true; } else { global::Console.vig.enabled = false; } } if (array[0] == "fx_dl") { if (array.Length != 2) { return; } if (global::Console.dl == null) { global::Console.dl = GameObject.Find("Directional light"); } if (global::Console.dl == null) { return; } int num13 = 0; if (!int.TryParse(array[1], out num13)) { return; } if (num13 > 0) { global::Console.dl.SetActive(true); } else { global::Console.dl.SetActive(false); } } if (array[0] == "fx_shadowweapon") { if (array.Length != 2) { return; } GameObject gameObject3 = GameObject.Find("maplight"); if (gameObject3) { gameObject3.SetActive(false); } } if (array[0] == "fx_lightweapon") { if (array.Length != 2) { return; } GameObject gameObject4 = GameObject.Find("lights"); if (gameObject4) { gameObject4.SetActive(false); } } if (array[0] == "devconnect") { PlayerPrefs.SetInt("localplay", 0); array[0] = "connect"; } if (array[0] == "connect") { if (array.Length < 3) { Client.cs.Connect(); return; } Client.IP = array[1]; int.TryParse(array[2], out Client.PORT); if (array.Length == 4) { Client.PASSWORD = array[3]; } else { Client.PASSWORD = string.Empty; } Client.cs.Connect(); } if (array[0] == "deadcam") { DeadCam.SetActive(true); } if (array[0] == "test") { Award.SetPoints(100); Award.SetCustomPoints(23, 0); } if (array[0] == "sens") { if (array.Length != 2) { return; } float num14; if (!float.TryParse(array[1], out num14)) { return; } vp_FPCamera.SetMouseSensitivity(num14); Options.sens = num14; PlayerPrefs.SetFloat("sens", num14); } if (array[0] == "zoomsens") { if (array.Length != 2) { return; } float num15; if (!float.TryParse(array[1], out num15)) { return; } vp_FPCamera.SetZoomSensitivity(num15); Options.zoomsens = num15; PlayerPrefs.SetFloat("zoomsens", num15); } if (array[0] == "disconnect") { GameObject gameObject5 = GameObject.Find("LocalPlayer"); GameObject gameObject6 = GameObject.Find("Sky"); GameObject gameObject7 = GameObject.Find("Sky Manager"); GameObject gameObject8 = GameObject.Find("GUI"); GameObject gameObject9 = GameObject.Find("Core"); if (gameObject5) { UnityEngine.Object.Destroy(gameObject5); } if (gameObject6) { UnityEngine.Object.Destroy(gameObject6); } if (gameObject7) { UnityEngine.Object.Destroy(gameObject7); } if (gameObject8) { UnityEngine.Object.Destroy(gameObject8); } if (gameObject9) { UnityEngine.Object.Destroy(gameObject9); } Client.cs.CloseClient(); Application.LoadLevel("main"); Screen.lockCursor = false; Cursor.visible = true; } if (array[0] == "crosshair_size") { if (array.Length != 2) { return; } int crosshairSize; if (!int.TryParse(array[1], out crosshairSize)) { return; } Crosshair.SetCrosshairSize(crosshairSize); } if (array[0] == "crosshair_color") { if (array.Length != 4) { return; } int r; if (!int.TryParse(array[1], out r)) { return; } int g; if (!int.TryParse(array[2], out g)) { return; } int b; if (!int.TryParse(array[3], out b)) { return; } Crosshair.SetCrosshairColor(r, g, b); } if (array[0] == "disableskymanager") { } if (array[0] == "atest") { Award.SetDeath(26, 0); } if (array[0] == "chat") { if (array.Length != 2) { return; } int num16; if (!int.TryParse(array[1], out num16)) { return; } if (num16 == 0) { Message.blockchat = true; } else { Message.blockchat = false; } } if (array[0] == "hud") { if (array.Length != 2) { return; } int num17 = 0; if (!int.TryParse(array[1], out num17)) { return; } if (num17 == 0 || num17 == 2) { HUD.ForceHide(true); Crosshair.ForceHide(true); Message.ForceHide(true); ScoreTop.SetActive(false); PlayerNames.SetActive(false); GameObject gameObject10 = GameObject.Find("WeaponCamera"); if (num17 == 2) { gameObject10.GetComponent <Camera>().cullingMask = -2147483648; Crosshair.ForceHide(false); } else { gameObject10.GetComponent <Camera>().cullingMask = 0; } } else if (num17 == 3) { HUD.ForceHide(true); Crosshair.ForceHide(true); Message.ForceHide(false); ScoreTop.SetActive(true); PlayerNames.SetActive(true); GameObject gameObject11 = GameObject.Find("WeaponCamera"); gameObject11.GetComponent <Camera>().cullingMask = 0; } else { HUD.ForceHide(false); Crosshair.ForceHide(false); Message.ForceHide(false); ScoreTop.SetActive(true); PlayerNames.SetActive(true); GameObject gameObject12 = GameObject.Find("WeaponCamera"); gameObject12.GetComponent <Camera>().cullingMask = -2147483648; } } if (array[0] == "spectator") { if (array.Length != 2) { return; } int num18 = 0; if (!int.TryParse(array[1], out num18)) { return; } if (num18 == 1) { SpecCam.show = true; Client.cs.send_chooseteam(255); GameObject gameObject13 = GameObject.Find("WeaponCamera"); gameObject13.GetComponent <Camera>().cullingMask = 0; } else { SpecCam.show = false; Client.cs.send_chooseteam(3); GameObject gameObject14 = GameObject.Find("WeaponCamera"); gameObject14.GetComponent <Camera>().cullingMask = -2147483648; } } if (array[0] == "m_steps") { if (array.Length != 2) { return; } int num19 = 0; if (!int.TryParse(array[1], out num19)) { return; } if (num19 > 20) { num19 = 20; } if (num19 < 1) { num19 = 1; } vp_FPCamera.MouseSmoothSteps = num19; } if (array[0] == "m_weight") { if (array.Length != 2) { return; } float num20 = 0f; if (!float.TryParse(array[1], out num20)) { return; } if (num20 > 1f) { num20 = 1f; } if (num20 < 0f) { num20 = 0f; } vp_FPCamera.MouseSmoothWeight = num20; } if (array[0] == "extralod") { if (array.Length != 2) { return; } int num21 = 0; if (!int.TryParse(array[1], out num21)) { return; } if (num21 == 0) { PlayerControll.extralod = false; } else { PlayerControll.extralod = true; } } if (array[0] == "showfps") { if (array.Length != 2) { return; } int num22 = 0; if (!int.TryParse(array[1], out num22)) { return; } if (num22 == 0) { global::Console.showfps = false; } else { global::Console.showfps = true; } } if (array[0] == "ping") { if (PlayerPrefs.GetString("devpass") != "6f66a0d73e9894e62fe0ee48c209911b") { return; } if (array.Length != 2) { return; } int num23 = 0; if (!int.TryParse(array[1], out num23)) { return; } PlayerPrefs.SetInt("ShowPing", num23); if (num23 == 1) { global::Ping.cs.ShowPing(true); } else { global::Ping.cs.ShowPing(false); } } if (array[0] == "nord") { if (array.Length != 2) { return; } int num24 = 0; if (!int.TryParse(array[1], out num24)) { return; } if (num24 == 0) { PlayerControll.nord = false; } else { PlayerControll.nord = true; } } if (array[0] == "devunlock") { } if (array[0] == "devnext") { } if (array[0] == "forcewin") { Client.cs.send_consolecmd(array[0], string.Empty); } if (array[0] == "name") { if (array.Length != 2) { return; } MonoBehaviour.print(array[0] + array[1]); Client.cs.send_consolecmd(array[0], array[1]); } else if (array[0] == "kill") { Client.cs.send_consolecmd(array[0], string.Empty); } else if (array[0] == "rcon") { if (array.Length != 2) { return; } Client.cs.send_consolecmd(array[0], array[1]); } else if (array[0] == "kick") { if (array.Length != 2) { return; } Client.cs.send_consolecmd(array[0], array[1]); } else if (array[0] == "banlist") { Client.cs.send_consolecmd(array[0], string.Empty); } else if (array[0] == "ban") { if (array.Length != 2) { return; } Client.cs.send_consolecmd(array[0], array[1]); } else if (array[0] == "password") { if (array.Length != 2) { return; } Client.cs.send_consolecmd(array[0], array[1]); } else if (array[0] == "startmoney") { if (array.Length != 2) { return; } int num25; if (!int.TryParse(array[1], out num25)) { return; } Client.cs.send_consolecmd(array[0], array[1]); } else if (array[0] == "fraglimit") { if (array.Length != 2) { return; } int num26; if (!int.TryParse(array[1], out num26)) { return; } Client.cs.send_consolecmd(array[0], array[1]); } else if (array[0] == "rr" || array[0] == "restart") { Client.cs.send_consolecmd(array[0], string.Empty); } else if (array[0] == "live") { Client.cs.send_consolecmd(array[0], string.Empty); } else if (array[0] == "skin_test") { if (array.Length != 2) { return; } Texture2D textureByName = TEX.GetTextureByName(array[1]); vp_FPWeapon vp_FPWeapon = (vp_FPWeapon)UnityEngine.Object.FindObjectOfType(typeof(vp_FPWeapon)); if (vp_FPWeapon.m_WeaponCoreModel != null && textureByName != null) { Component[] componentsInChildren = vp_FPWeapon.m_WeaponCoreModel.GetComponentsInChildren(typeof(Renderer)); for (int k = 0; k < componentsInChildren.Length; k++) { Renderer renderer = (Renderer)componentsInChildren[k]; if (!(renderer.name == "merc_hands")) { if (!(renderer.name == "warcorp_hands")) { renderer.materials[0].SetTexture(0, textureByName); } } } } } }
/// <summary> /// /// </summary> protected override void Awake() { base.Awake(); m_Inventory = Manager.Player.GetComponent<vp_Inventory>(); m_FPCamera = Manager.Player.GetComponentInChildren<vp_FPCamera>(); m_WeaponItems = m_FPCamera.GetComponentsInChildren<vp_ItemIdentifier>().ToList(); // sort the weapons alphabetically IComparer comparer = new WeaponComparer(); m_WeaponItems.Sort(comparer.Compare); }
/// <summary> /// cache all the necessary properties here /// </summary> protected virtual void Awake() { m_Player = GameObject.FindObjectOfType(typeof(vp_FPPlayerEventHandler)) as vp_FPPlayerEventHandler; m_Camera = GameObject.FindObjectOfType(typeof(vp_FPCamera)) as vp_FPCamera; m_Controller = GameObject.FindObjectOfType(typeof(vp_FPController)) as vp_FPController; m_Audio = gameObject.AddComponent<AudioSource>(); // add a new audio source for this class to use }
// Use this for initialization protected override void Awake() { base.Awake(); // initial setup m_Audio = GetComponent<AudioSource>(); m_CharacterController = gameObject.GetComponent<CharacterController>(); m_Controller = (vp_FPController)transform.root.GetComponentInChildren(typeof(vp_FPController)); m_Player = (ac_FPParkourEventHandler)transform.root.GetComponentInChildren(typeof(ac_FPParkourEventHandler)); m_Camera = GetComponentInChildren<vp_FPCamera>(); m_Transform = transform; m_FootstepManager = (vp_FootstepManager)transform.root.GetComponentInChildren(typeof(vp_FootstepManager)); m_currentDoubleJump = DoubleJumpCount ; m_CanWallRunAgain = Time.time; m_CanDashAgain = Time.time; m_CanGroundslideAgain = Time.time; // spawn the parkour arm at world origin and hide it if(ParkourArmPrefab != null) { ParkourArmPrefab = (GameObject)Object.Instantiate(ParkourArmPrefab,Vector3.zero,Quaternion.identity); ParkourArmPrefab.SetActive(false); } }
void Awake() { bridge = GetComponent <FPPlayerLuaBridge>(); fpController = GetComponentInChildren <vp_FPController>(); fpCamera = GetComponentInChildren <vp_FPCamera>(); }
/// <summary> /// /// </summary> protected virtual void Awake() { Player = (vp_FPPlayerEventHandler)transform.root.GetComponentInChildren(typeof(vp_FPPlayerEventHandler)); m_FPCamera = GetComponentInChildren <vp_FPCamera>(); }
/// <summary> /// /// </summary> void Start() { if (Player == null) { vp_Utility.Activate(gameObject, false); Debug.LogWarning("Warning (" + this + ") No player gameobject assigned. Disabling demo."); return; } m_FPSCamera = (vp_FPCamera)Component.FindObjectOfType(typeof(vp_FPCamera)); m_Demo = new vp_FPSDemoManager(Player); m_Demo.CurrentFullScreenFadeTime = Time.time; m_Demo.DrawCrosshair = false; m_Demo.Input.MouseCursorZones = new Rect[3]; m_Demo.Input.MouseCursorZones[0] = new Rect((Screen.width * 0.5f) - 370, 40, 80, 80); m_Demo.Input.MouseCursorZones[1] = new Rect((Screen.width * 0.5f) + 290, 40, 80, 80); m_Demo.Input.MouseCursorZones[2] = new Rect(0, 0, 150, Screen.height); vp_Utility.LockCursor = false; m_LookPoints[1] = new Vector3(129.3f, 122, -186); m_LookPoints[2] = new Vector3(129.3f, 85, -186); m_LookPoints[3] = new Vector3(147, 85, -186); m_LookPoints[4] = new Vector3(12, 85, -214); m_LookPoints[5] = new Vector3(129, 122, -118); m_LookPoints[6] = new Vector3(125.175f, 106.1071f, -97.58212f); m_LookPoints[7] = new Vector3(119.6f, 104.2f, -89.1f); m_LookPoints[8] = new Vector3(129, 112, -150); // prevent regular event handler weapon switching events m_Demo.PlayerEventHandler.SetWeapon.Disallow(10000000); m_Demo.PlayerEventHandler.SetPrevWeapon.Try = delegate() { return false; }; m_Demo.PlayerEventHandler.SetNextWeapon.Try = delegate() { return false; }; // manually register our fallimpact method with the player event handler // NOTE: this is not the typical event handler workflow. see the manual // event handler chapter for more info m_Demo.PlayerEventHandler.FallImpact.Register(this, "FallImpact", 0); }
/// <summary> /// /// </summary> protected override void Start() { base.Start(); m_Controller = (vp_FPController)Root.GetComponent(typeof(vp_FPController)); m_Camera = (vp_FPCamera)Root.GetComponentInChildren(typeof(vp_FPCamera)); m_Weapon = (vp_FPWeapon)Transform.GetComponent(typeof(vp_FPWeapon)); }
public static void Spawn(float x, float y, float z, float angle) { GameObject gameObject = GameObject.Find("LocalPlayer"); vp_FPCamera vp_FPCamera = (vp_FPCamera)UnityEngine.Object.FindObjectOfType(typeof(vp_FPCamera)); vp_FPController vp_FPController = (vp_FPController)UnityEngine.Object.FindObjectOfType(typeof(vp_FPController)); gameObject.transform.position = new Vector3(x, y, z); vp_FPCamera.SetRotation(new Vector2(0f, angle), true, true); ChooseTeam.SetActive(false); vp_FPCamera.SetMouseFreeze(false); vp_FPController.m_CharacterController.enabled = true; BasePlayer.health = 100; Crosshair.SetActive(true); Crosshair.forceLockCursor = true; HUD.SetActive(true); HUD.cs.OnResize(); BasePlayer.deadflag = 0; if (Client.ID != -1) { PlayerControll.Player[Client.ID].DeadFlag = 0; } vp_FPInput.cs.AllowGameplayInput = true; BasePlayer.selectedGrenade = 0; vp_FPInput.grenadeThrowStarting = false; vp_FPInput.grenadeThrowEnding = false; vp_FPInput.fastGrenade = false; vp_FPInput.mouseDown = false; vp_FPInput.mouseUp = false; if (GameData.restartroundmode != 1 && ScoreBoard.gamemode != 0) { vp_FPWeapon.RemoveAllMapWeapon(); vp_FPWeapon.RemoveAllMapSmoke(); } CutoffFX.RemoveFX(); vp_FPCamera.cs.SetFlashFX(0f, 3.5f); BlackScreen.SetActive(false); Zombie.SetInfectedScreen(false); Zombie.repelVector = Vector2.zero; if (Client.ID != -1) { PlayerControll.Player[Client.ID].bomb = false; } if (Client.ID != -1) { PlayerControll.Player[Client.ID].defuse = false; } ScoreTop.UpdateData(); if (BasePlayer.weapon[0] == null) { BasePlayer.weapon[0] = null; } else { BasePlayer.weapon[0] = new CWeapon(WeaponData.GetData(BasePlayer.weapon[0].data.wid)); } if (BasePlayer.weapon[1] == null) { BasePlayer.weapon[1] = new CWeapon(WeaponData.GetData(1)); } else { BasePlayer.weapon[1] = new CWeapon(WeaponData.GetData(BasePlayer.weapon[1].data.wid)); } if (BasePlayer.weapon[2] == null) { BasePlayer.weapon[2] = new CWeapon(WeaponData.GetData(28)); } BasePlayer.weapon[3] = null; if (BasePlayer.weapon[4] == null) { BasePlayer.weapon[4] = null; } BasePlayer.weapon[5] = null; BasePlayer.weapon[6] = null; if (BasePlayer.weapon[7] == null) { BasePlayer.weapon[7] = new CWeapon(WeaponData.GetData(31)); } if (BasePlayer.weapon[9] == null) { BasePlayer.weapon[9] = new CWeapon(WeaponData.GetData(26)); } BasePlayer.currweapon = null; BasePlayer.CalcAmmo(); vp_FPWeaponHandler.cs.m_CurrentWeaponID = 0; if (BasePlayer.weapon[0] != null) { vp_FPInput.cs.Player.SetWeaponByName.Try(BasePlayer.weapon[0].data.selectName); } else if (BasePlayer.weapon[1] != null) { vp_FPInput.cs.Player.SetWeaponByName.Try(BasePlayer.weapon[1].data.selectName); } else if (BasePlayer.weapon[2] != null) { vp_FPInput.cs.Player.SetWeaponByName.Try(BasePlayer.weapon[2].data.selectName); } BasePlayer.lastdroppeduid = -1; BuyMenu.ShowBuy(x, y, z); HitEffect.Reset(); SpecCam.SetActive(false); DeadCam.SetActive(false); DeadCam.setspectime = 0f; Message.ResetMessage(); HUD.ResetRespawnBar(); Award.lastaward = 0; global::Console.cs.Command("hud 1"); HUD.PlayStop(); Message.SetDead(false); PlayerNames.hideradar = false; C4.GetPlants(); C4.isplanting = false; C4.isdiffusing = false; BasePlayer.spawntime = Time.time; CC.CheckOnce(); }