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 = 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 }
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> /// 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 override void Awake() { vp_FPController.cs = this; base.Awake(); this.m_CharacterController = base.gameObject.GetComponent <CharacterController>(); this.m_NormalHeight = this.CharacterController.height; this.CharacterController.center = (this.m_NormalCenter = new Vector3(0f, this.m_NormalHeight * 0.5f, 0f)); this.CharacterController.radius = this.m_NormalHeight * 0.25f; this.m_CrouchHeight = this.m_NormalHeight * 0.5f; this.m_CrouchCenter = this.m_NormalCenter * 0.5f; this.m_CharacterController.enabled = false; this.steps_audio = base.gameObject.AddComponent <AudioSource>(); this.steps_walk_concrete[0] = SND.GetSoundByName("player/movement/walk_concrete1"); this.steps_walk_concrete[1] = SND.GetSoundByName("player/movement/walk_concrete2"); this.steps_walk_concrete[2] = SND.GetSoundByName("player/movement/walk_concrete3"); this.steps_walk_concrete[3] = SND.GetSoundByName("player/movement/walk_concrete4"); this.steps_run_concrete[0] = SND.GetSoundByName("player/movement/run_concrete1"); this.steps_run_concrete[1] = SND.GetSoundByName("player/movement/run_concrete2"); this.steps_run_concrete[2] = SND.GetSoundByName("player/movement/run_concrete3"); this.steps_run_concrete[3] = SND.GetSoundByName("player/movement/run_concrete4"); this.steps_walk_gravel[0] = SND.GetSoundByName("player/movement/walk_gravel1"); this.steps_walk_gravel[1] = SND.GetSoundByName("player/movement/walk_gravel2"); this.steps_walk_gravel[2] = SND.GetSoundByName("player/movement/walk_gravel3"); this.steps_walk_gravel[3] = SND.GetSoundByName("player/movement/walk_gravel4"); this.steps_run_gravel[0] = SND.GetSoundByName("player/movement/run_gravel1"); this.steps_run_gravel[1] = SND.GetSoundByName("player/movement/run_gravel2"); this.steps_run_gravel[2] = SND.GetSoundByName("player/movement/run_gravel3"); this.steps_run_gravel[3] = SND.GetSoundByName("player/movement/run_gravel4"); }
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 }
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 override void Awake() { base.Awake(); m_Parkour = (ac_FPParkour)transform.root.GetComponentInChildren(typeof(ac_FPParkour)); charactercontroller = (CharacterController)transform.root.GetComponentInChildren(typeof(CharacterController)); m_Controller = (vp_FPController)transform.root.GetComponentInChildren(typeof(vp_FPController)); }
protected override void Awake() { base.Awake(); m_Parkour = (ac_FPParkour)transform.root.GetComponentInChildren(typeof(ac_FPParkour)); charactercontroller = (CharacterController)transform.root.GetComponentInChildren(typeof(CharacterController)); m_Controller = (vp_FPController)transform.root.GetComponentInChildren(typeof(vp_FPController)); }
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>(); }
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 }
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>(); } }
/// <summary> /// hooks up the component object as the inspector target /// </summary> public virtual void OnEnable() { m_Component = (vp_FPController)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(); }
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> /// hooks up the component object as the inspector target /// </summary> public virtual void OnEnable() { m_Component = (vp_FPController)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; }
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; } }
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); }
/// <summary> /// calculates the maximum running speeds of this controller /// </summary> protected virtual void InitMaxSpeeds() { if (Player.IsLocal.Get()) { // get max speed of first vp_FPController that we can find under the ancestor vp_FPController controller = Transform.root.GetComponentInChildren <vp_FPController>(); m_MaxWalkSpeed = controller.CalculateMaxSpeed(); m_MaxRunSpeed = controller.CalculateMaxSpeed("Run"); m_MaxCrouchSpeed = controller.CalculateMaxSpeed("Crouch"); //Debug.Log("m_MaxWalkSpeed: " + m_MaxWalkSpeed + ", m_MaxRunSpeed: " + m_MaxRunSpeed + ", m_MaxCrouchSpeed: " + m_MaxCrouchSpeed); } else { // TEMP: hardcoded for remote players m_MaxWalkSpeed = 3.999999f; m_MaxRunSpeed = 10.08f; m_MaxCrouchSpeed = 1.44f; } }
public static void SetActive(bool val) { SpecCam.show = val; if (!val) { SpecCam.FID = -1; SpecCam.mode = 0; GameObject gameObject = GameObject.Find("WeaponCamera"); gameObject.GetComponent <Camera>().cullingMask = -2147483648; } else { vp_FPController vp_FPController = (vp_FPController)UnityEngine.Object.FindObjectOfType(typeof(vp_FPController)); if (vp_FPController) { vp_FPController.m_CharacterController.enabled = true; } } }
/// <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 }
/// <summary>Handles debugging features</summary> private void Update() { // retrieve the directors { if (_inputDir) // prevent user from submitting bug reports. { var bugReportUI = _inputDir.bugReportPrefab.GetComponentInChildren<BugReportUI>(); bugReportUI.submitButton.interactable = false; bugReportUI.summaryField.interactable = false; bugReportUI.descField.interactable = false; bugReportUI.summaryField.text = "Debug Menu Mod installed - Reporting Issues is deactivated"; bugReportUI.descField.text = "Notice: While this debug menu mod is active, you will not be able to report bugs. " + "This mod is not supported by Monomi Park and never will be."; } } // retrieve object and component references if (!_player) _player = GameObject.Find("SimplePlayer"); if (!_fpController) { _fpController = _player?.GetComponent<vp_FPController>(); if (_noclip) StartNoclip(); } if (!_camera) _camera = GameObject.Find("FPSCamera"); if (!_hudUi) _hudUi = GameObject.Find("HudUI"); // the debug menu shouldn't function if the game is frozen if (Time.timeScale <= 0f) return; // toggle the debug menu if (Input.GetKeyDown(KeyCode.F9)) { _debug = !_debug; // if the debug menu was on previously, // turn off any cheats that may be on. if (!_debug) { _noclip = false; _infiniteEnergy = false; _infiniteHealth = false; // make hud visible _hudUi?.SetActive(true); } } // debug mode is off, nothing more to do here if (!_debug) return; // decrement time of day if (Input.GetKeyDown(KeyCode.LeftBracket)) { _timeDir?.AdjustTimeOfDay(-0.0416666679f); // check for negative time if (_timeDir?.WorldTime() <= 0f) _timeDir?.SetWorldTime(0f); } // increment time of day else if (Input.GetKeyDown(KeyCode.RightBracket)) _timeDir?.AdjustTimeOfDay(0.0416666679f); // toggle help menu if (Input.GetKeyDown(KeyCode.F10)) _showHelp = !_showHelp; // add 1000 credits if (Input.GetKeyDown(KeyCode.Equals) || Input.GetKeyDown(KeyCode.KeypadPlus)) _playerState?.AddCurrency(1000); // subtract 1000 credits else if (Input.GetKeyDown(KeyCode.Minus) || Input.GetKeyDown(KeyCode.KeypadMinus)) _playerState?.AddCurrency(-1000); // toggle heads-up display if (Input.GetKeyDown(KeyCode.F6)) _hudUi?.SetActive(!_hudUi.activeSelf); // reset player progress if (Input.GetKeyDown(KeyCode.F12)) { Console.WriteLine("DEBUG: Tutorials/Pedia/Achievements/Progress Reset"); _pediaDir?.DebugClearUnlocked(); _tutorialDir?.DebugClearCompleted(); _achieveDir?.DebugClearAwarded(); _progressDir?.DebugClearProgress(); } // unlock all progress else if (Input.GetKeyDown(KeyCode.F11)) { Console.WriteLine("DEBUG: Tutorials/Pedia/Achievements/Progress Unlocked"); _pediaDir?.DebugAllUnlocked(); _tutorialDir?.DebugAllCompleted(); _progressDir?.DebugUnlockProgress(); } // unlock all upgrades if (Input.GetKeyDown(KeyCode.Alpha0)) { Console.WriteLine("DEBUG: All Personal Upgrades"); _playerState?.DebugGiveAllUpgrades(); _playerState?.SetHealth(_playerState.GetMaxHealth()); _playerState?.SetEnergy(_playerState.GetMaxEnergy()); // add 5 keys for (var i = 0; i < 5; i++) _playerState?.AddKey(); } // fill inventory with random items and ammo if (Input.GetKeyDown(KeyCode.Alpha9) && _playerState) { Console.WriteLine("DEBUG: Fill Ammo"); _playerState?.Ammo?.DebugFillRandomAmmo(); } // toggle infinite energy if (Input.GetKeyDown(KeyCode.Alpha6)) _infiniteEnergy = !_infiniteEnergy; // toggle infinite health if (Input.GetKeyDown(KeyCode.Alpha7)) _infiniteHealth = !_infiniteHealth; // clear inventory if (Input.GetKeyDown(KeyCode.K)) _playerState?.Ammo?.Clear(); // refill inventory if (Input.GetKeyDown(KeyCode.L) && _playerState) _playerState?.Ammo?.DebugRefillAmmo(); // toggle noclip if (Input.GetKeyDown(KeyCode.N) && _player) { if (!_noclip) StartNoclip(); else StopNoclip(); } // force the game to save if (Input.GetKeyDown(KeyCode.Alpha8)) { Console.WriteLine("DEBUG: Forcing save now"); _autoSave?.SaveAllNow(); } // handle noclip, if it's enabled if (_noclip && _camera && _fpController) { // calculate speed, will be multiplied by two if run is held var speed = 20f * (SRInput.Actions.run.State ? 2f : 1f); // add movement _noclipPos += _camera.transform.forward * SRInput.Actions.vertical.RawValue * speed * Time.deltaTime; _noclipPos += _camera.transform.right * SRInput.Actions.horizontal.RawValue * speed * Time.deltaTime; // stop all movement on the controller and reposition it _fpController?.Stop(); _fpController?.SetPosition(_noclipPos); } if (_infiniteEnergy && _playerState) // infinite energy's on, set our energy to max _playerState.SetEnergy(_playerState.GetMaxEnergy()); if (_infiniteHealth && _playerState) // god mode's on, set our health to max _playerState.SetHealth(_playerState.GetMaxHealth()); }
void Awake() { bridge = GetComponent<FPPlayerLuaBridge>(); fpController = GetComponentInChildren<vp_FPController>(); fpCamera = GetComponentInChildren<vp_FPCamera>(); }
/// <summary> /// in 'Awake' we do things that need to be run once at the /// very beginning. NOTE: as of Unity 4, gameobject hierarchy /// can not be altered in 'Awake' /// </summary> protected override void Awake() { base.Awake(); FPController = Root.GetComponent<vp_FPController>(); // run 'SetRotation' with the initial rotation of the camera. this is important // when not using the spawnpoint system (or player rotation will snap to zero yaw) SetRotation(new Vector2(Transform.eulerAngles.x, Transform.eulerAngles.y)); // set parent gameobject layer to 'LocalPlayer', so camera can exclude it // this also prevents shell casings from colliding with the charactercollider Parent.gameObject.layer = vp_Layer.LocalPlayer; // TODO: removed for multiplayer. evaluate consequences //foreach (Transform b in Parent) //{ // if (b.gameObject.layer != vp_Layer.RemotePlayer) // b.gameObject.layer = vp_Layer.LocalPlayer; //} // main camera initialization // render everything except body and weapon GetComponent<Camera>().cullingMask &= ~((1 << vp_Layer.LocalPlayer) | (1 << vp_Layer.Weapon)); GetComponent<Camera>().depth = 0; // weapon camera initialization // find a regular Unity Camera component existing in a child // gameobject to the FPSCamera's gameobject. if we don't find // a weapon cam, that's OK (some games don't have weapons) Camera weaponCam = null; foreach (Transform t in Transform) { weaponCam = (Camera)t.GetComponent(typeof(Camera)); if (weaponCam != null) { weaponCam.transform.localPosition = Vector3.zero; weaponCam.transform.localEulerAngles = Vector3.zero; weaponCam.clearFlags = CameraClearFlags.Depth; weaponCam.cullingMask = (1 << vp_Layer.Weapon); // only render the weapon weaponCam.depth = 1; weaponCam.farClipPlane = 100; weaponCam.nearClipPlane = 0.01f; weaponCam.fieldOfView = 60; break; } } // create springs for camera motion // --- primary position spring --- // this is used for all sorts of positional force acting on the camera m_PositionSpring = new vp_Spring(Transform, vp_Spring.UpdateMode.Position, false); m_PositionSpring.MinVelocity = 0.00001f; m_PositionSpring.RestState = PositionOffset; // --- secondary position spring --- // this is mainly intended for positional force from recoil, stomping and explosions m_PositionSpring2 = new vp_Spring(Transform, vp_Spring.UpdateMode.PositionAdditiveLocal, false); m_PositionSpring2.MinVelocity = 0.00001f; // --- rotation spring --- // this is used for all sorts of angular force acting on the camera m_RotationSpring = new vp_Spring(Transform, vp_Spring.UpdateMode.RotationAdditiveLocal, false); m_RotationSpring.MinVelocity = 0.00001f; }
/// <summary> /// in 'Awake' we do things that need to be run once at the /// very beginning. NOTE: as of Unity 4, gameobject hierarchy /// can not be altered in 'Awake' /// </summary> protected override void Awake() { base.Awake(); FPController = Root.GetComponent<vp_FPController>(); // detect angle of camera at moment of startup. this will be added to all mouse // input and is needed to retain initial rotation set by user in the editor. m_InitialRotation = new Vector2(Transform.eulerAngles.y, Transform.eulerAngles.x); // set parent gameobject layer to 'LocalPlayer', so camera can exclude it Parent.gameObject.layer = vp_Layer.LocalPlayer; foreach (Transform b in Parent) { b.gameObject.layer = vp_Layer.LocalPlayer; } // main camera initialization // render everything except body and weapon camera.cullingMask &= ~((1 << vp_Layer.LocalPlayer) | (1 << vp_Layer.Weapon)); camera.depth = 0; // weapon camera initialization // find a regular Unity Camera component existing in a child // gameobject to the FPSCamera's gameobject. if we don't find // a weapon cam, that's OK (some games don't have weapons) Camera weaponCam = null; foreach (Transform t in Transform) { weaponCam = (Camera)t.GetComponent(typeof(Camera)); if (weaponCam != null) { weaponCam.transform.localPosition = Vector3.zero; weaponCam.transform.localEulerAngles = Vector3.zero; weaponCam.clearFlags = CameraClearFlags.Depth; weaponCam.cullingMask = (1 << vp_Layer.Weapon); // only render the weapon weaponCam.depth = 1; weaponCam.farClipPlane = 100; weaponCam.nearClipPlane = 0.01f; weaponCam.fieldOfView = 60; break; } } // create springs for camera motion // --- primary position spring --- // this is used for all sorts of positional force acting on the camera m_PositionSpring = new vp_Spring(Transform, vp_Spring.UpdateMode.Position, false); m_PositionSpring.MinVelocity = 0.00001f; m_PositionSpring.RestState = PositionOffset; // --- secondary position spring --- // this is mainly intended for positional force from recoil, stomping and explosions m_PositionSpring2 = new vp_Spring(Transform, vp_Spring.UpdateMode.PositionAdditive, false); m_PositionSpring2.MinVelocity = 0.00001f; // --- rotation spring --- // this is used for all sorts of angular force acting on the camera m_RotationSpring = new vp_Spring(Transform, vp_Spring.UpdateMode.RotationAdditive, false); m_RotationSpring.MinVelocity = 0.00001f; }
/// <summary> /// in 'Awake' we do things that need to be run once at the /// very beginning. NOTE: as of Unity 4, gameobject hierarchy /// can not be altered in 'Awake' /// </summary> protected override void Awake() { base.Awake(); FPController = Root.GetComponent <vp_FPController>(); // detect angle of camera at moment of startup. this will be added to all mouse // input and is needed to retain initial rotation set by user in the editor. m_InitialRotation = new Vector2(Transform.eulerAngles.y, Transform.eulerAngles.x); // set parent gameobject layer to 'LocalPlayer', so camera can exclude it Parent.gameObject.layer = vp_Layer.LocalPlayer; foreach (Transform b in Parent) { b.gameObject.layer = vp_Layer.LocalPlayer; } // main camera initialization // render everything except body and weapon GetComponent <Camera>().cullingMask &= ~((1 << vp_Layer.LocalPlayer) | (1 << vp_Layer.Weapon)); GetComponent <Camera>().depth = 0; // weapon camera initialization // find a regular Unity Camera component existing in a child // gameobject to the FPSCamera's gameobject. if we don't find // a weapon cam, that's OK (some games don't have weapons) Camera weaponCam = null; foreach (Transform t in Transform) { weaponCam = (Camera)t.GetComponent(typeof(Camera)); if (weaponCam != null) { weaponCam.transform.localPosition = Vector3.zero; weaponCam.transform.localEulerAngles = Vector3.zero; weaponCam.clearFlags = CameraClearFlags.Depth; weaponCam.cullingMask = (1 << vp_Layer.Weapon); // only render the weapon weaponCam.depth = 1; weaponCam.farClipPlane = 100; weaponCam.nearClipPlane = 0.01f; weaponCam.fieldOfView = 60; break; } } // create springs for camera motion // --- primary position spring --- // this is used for all sorts of positional force acting on the camera m_PositionSpring = new vp_Spring(Transform, vp_Spring.UpdateMode.Position, false); m_PositionSpring.MinVelocity = 0.00001f; m_PositionSpring.RestState = PositionOffset; // --- secondary position spring --- // this is mainly intended for positional force from recoil, stomping and explosions m_PositionSpring2 = new vp_Spring(Transform, vp_Spring.UpdateMode.PositionAdditive, false); m_PositionSpring2.MinVelocity = 0.00001f; // --- rotation spring --- // this is used for all sorts of angular force acting on the camera m_RotationSpring = new vp_Spring(Transform, vp_Spring.UpdateMode.RotationAdditive, false); m_RotationSpring.MinVelocity = 0.00001f; }
/// <summary>Handles debugging features</summary> private void Update() { // the debug menu shouldn't function if the game is frozen if (Time.timeScale <= 0f) { return; } // toggle the debug menu if (Input.GetKeyDown(KeyCode.F9)) { _debug = !_debug; // if the debug menu was on previously, // turn off any cheats that may be on. if (!_debug) { _noclip = false; _infiniteEnergy = false; _infiniteHealth = false; // make hud visible _hudUi.SetActive(true); } } // debug mode is off, nothing more to do here if (!_debug) { return; } // retrieve object and component references if (_player == null) { _player = GameObject.Find("SimplePlayer"); } if (_fpController == null) { _fpController = _player?.GetComponent <vp_FPController>(); } if (_camera == null) { _camera = GameObject.Find("FPSCamera"); } if (_hudUi == null) { _hudUi = GameObject.Find("HudUI"); } // decrement time of day if (Input.GetKeyDown(KeyCode.LeftBracket)) { _timeDir.AdjustTimeOfDay(-0.0416666679f); // check for negative time if (_timeDir.WorldTime() <= 0f) { _timeDir.SetWorldTime(0f); } } // increment time of day else if (Input.GetKeyDown(KeyCode.RightBracket)) { _timeDir.AdjustTimeOfDay(0.0416666679f); } // toggle help menu if (Input.GetKeyDown(KeyCode.F10)) { _showHelp = !_showHelp; } // add 1000 credits if (Input.GetKeyDown(KeyCode.Equals) || Input.GetKeyDown(KeyCode.KeypadPlus)) { _playerState.AddCurrency(1000); } // subtract 1000 credits else if (Input.GetKeyDown(KeyCode.Minus) || Input.GetKeyDown(KeyCode.KeypadMinus)) { _playerState.AddCurrency(-1000); } // toggle heads-up display if (Input.GetKeyDown(KeyCode.F6)) { _hudUi.SetActive(!_hudUi.activeSelf); } // reset player progress if (Input.GetKeyDown(KeyCode.F12)) { Console.WriteLine("DEBUG: Tutorials/Pedia/Achievements/Progress Reset"); _pediaDir.DebugClearUnlocked(); _tutorialDir.DebugClearCompleted(); _achieveDir.DebugClearAwarded(); _progressDir.DebugClearProgress(); } // unlock all progress else if (Input.GetKeyDown(KeyCode.F11)) { Console.WriteLine("DEBUG: Tutorials/Pedia/Achievements/Progress Unlocked"); _pediaDir.DebugAllUnlocked(); _tutorialDir.DebugAllCompleted(); _achieveDir.DebugAllAwarded(); _progressDir.DebugUnlockProgress(); } // unlock all upgrades if (Input.GetKeyDown(KeyCode.Alpha0)) { Console.WriteLine("DEBUG: All Personal Upgrades"); _playerState.DebugGiveAllUpgrades(); _playerState.SetHealth(_playerState.GetMaxHealth()); _playerState.SetEnergy(_playerState.GetMaxEnergy()); // add 5 keys for (var i = 0; i < 5; i++) { _playerState.AddKey(); } } // fill inventory with random items and ammo if (Input.GetKeyDown(KeyCode.Alpha9)) { Console.WriteLine("DEBUG: Fill Ammo"); _playerState.Ammo.DebugFillRandomAmmo(_playerState.GetMaxAmmo()); } // toggle infinite energy if (Input.GetKeyDown(KeyCode.Alpha6)) { _infiniteEnergy = !_infiniteEnergy; } // toggle infinite health if (Input.GetKeyDown(KeyCode.Alpha7)) { _infiniteHealth = !_infiniteHealth; } // clear inventory if (Input.GetKeyDown(KeyCode.M)) { _playerState.Ammo.Clear(); } // toggle noclip if (Input.GetKeyDown(KeyCode.N) && _player) { _noclip = !_noclip; _noclipPos = _player.transform.position; } // force the game to save if (Input.GetKeyDown(KeyCode.Alpha8)) { Console.WriteLine("DEBUG: Forcing save now"); _autoSave.SaveAllNow(); } // handle noclip, if it's enabled if (_noclip && _camera && _fpController) { // calculate speed, will be multiplied by two if run is held var speed = 20f * (SRInput.Actions.run.State ? 2f : 1f); // add movement _noclipPos += _camera.transform.forward * SRInput.Actions.vertical.RawValue * speed * Time.deltaTime; _noclipPos += _camera.transform.right * SRInput.Actions.horizontal.RawValue * speed * Time.deltaTime; // stop all movement on the controller and reposition it _fpController.Stop(); _fpController.SetPosition(_noclipPos); } if (_infiniteEnergy) // infinite energy's on, set our energy to max { _playerState.SetEnergy(_playerState.GetMaxEnergy()); } if (_infiniteHealth) // god mode's on, set our health to max { _playerState.SetHealth(_playerState.GetMaxHealth()); } }
/// <summary> /// in 'Awake' we do things that need to be run once at the /// very beginning. NOTE: as of Unity 4, gameobject hierarchy /// can not be altered in 'Awake' /// </summary> protected override void Awake() { base.Awake(); FPController = Root.GetComponent <vp_FPController>(); // run 'SetRotation' with the initial rotation of the camera. this is important // when not using the spawnpoint system (or player rotation will snap to zero yaw) SetRotation(new Vector2(Transform.eulerAngles.x, Transform.eulerAngles.y)); // set parent gameobject layer to 'LocalPlayer', so camera can exclude it // this also prevents shell casings from colliding with the charactercollider Parent.gameObject.layer = vp_Layer.LocalPlayer; // TEST: removed for multiplayer. please report if this causes trouble //foreach (Transform b in Parent) //{ //if (b.gameObject.layer != vp_Layer.RemotePlayer) //b.gameObject.layer = vp_Layer.LocalPlayer; //} // main camera initialization // render everything except body and weapon Camera.cullingMask &= ~((1 << vp_Layer.LocalPlayer) | (1 << vp_Layer.Weapon)); Camera.depth = 0; // weapon camera initialization // find a regular Unity Camera component existing in a child // gameobject to the FPSCamera's gameobject. if we don't find // a weapon cam, that's OK (some games don't have weapons). // NOTE: we don't use GetComponentInChildren here because that // would return the MainCamera (on this transform) Camera weaponCam = null; foreach (Transform t in Transform) { weaponCam = (Camera)t.GetComponent(typeof(Camera)); if (weaponCam != null) { weaponCam.transform.localPosition = Vector3.zero; weaponCam.transform.localEulerAngles = Vector3.zero; weaponCam.clearFlags = CameraClearFlags.Depth; weaponCam.cullingMask = (1 << vp_Layer.Weapon); // only render the weapon weaponCam.depth = 1; weaponCam.farClipPlane = 100; weaponCam.nearClipPlane = 0.01f; weaponCam.fieldOfView = 60; break; } } // create springs for camera motion // --- primary position spring --- // this is used for all sorts of positional force acting on the camera m_PositionSpring = new vp_Spring(Transform, vp_Spring.UpdateMode.Position, false); m_PositionSpring.MinVelocity = 0.0f; m_PositionSpring.RestState = PositionOffset; // --- secondary position spring --- // this is mainly intended for positional force from recoil, stomping and explosions m_PositionSpring2 = new vp_Spring(Transform, vp_Spring.UpdateMode.PositionAdditiveLocal, false); m_PositionSpring2.MinVelocity = 0.0f; // --- rotation spring --- // this is used for all sorts of angular force acting on the camera m_RotationSpring = new vp_Spring(Transform, vp_Spring.UpdateMode.RotationAdditiveLocal, false); m_RotationSpring.MinVelocity = 0.0f; #if UNITY_EDITOR #if UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6 || UNITY_2017_1 if (DisableVRModeOnStartup && UnityEngine.VR.VRSettings.enabled) { UnityEngine.VR.VRSettings.enabled = false; } #else if (DisableVRModeOnStartup && UnityEngine.XR.XRSettings.enabled) { UnityEngine.XR.XRSettings.enabled = false; } #endif #endif }
/// <summary> /// creates a copy of the currently selected UFPS player gameobject /// - stripped of all its 1st person functionality. the new object /// can be used for AI or multiplayer remote players /// </summary> public static void Generate() { GameObject target = Selection.activeObject as GameObject; if ((target == null) || (!vp_Utility.IsActive(target)) || (target.GetComponentInChildren <vp_FPController>() == null) && (target.GetComponentInChildren <vp_FPCamera>() == null)) { EditorUtility.DisplayDialog("Failed to run wizard", "Please select the main gameobject of a 1st person player in the Hierarchy view (make sure it's active) and try again.", "OK"); return; } if (!EditorUtility.DisplayDialog("Generate Remote Player?", "This wizard will create a copy of the selected player object - stripped of all its 1st person functionality. This new object can be used for AI or multiplayer remote players.\n\nNOTE: Only default UFPS classes will be processed.", "OK", "Cancel")) { return; } DecideCopyStates(target); string name = target.name + "(Remote)"; // generate - and operate upon - a copy of the target target = (GameObject)GameObject.Instantiate(target); target.name = target.name.Replace("(Clone)", ""); try { // layer likely should no longer be 'LocalPlayer', so default to 'RemotePlayer' target.gameObject.layer = vp_Layer.RemotePlayer; // convert weapons ConvertWeaponsTo3rdPerson(target); // find any charactercontroller and convert it into a capsulecollider with a rigidbody CharacterController ch = target.GetComponentInChildren <CharacterController>(); if (ch != null) { if (ch.transform.GetComponent <Rigidbody>() == null) { CapsuleCollider ca = ch.gameObject.AddComponent <CapsuleCollider>(); ca.radius = ch.radius; ca.height = ch.height; ca.center = ca.center; Rigidbody r = ch.gameObject.AddComponent <Rigidbody>(); r.useGravity = false; r.isKinematic = true; r.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic; } } // convert 1st person controller vp_FPController fpController = target.GetComponent <vp_FPController>(); if (fpController != null) { vp_CapsuleController cController = target.AddComponent <vp_CapsuleController>(); vp_EditorUtility.CopyValuesFromDerivedComponent(fpController, cController, true, false, null); // TEST: fpcontroller is not derived from capsulecontroller! see note in 'GenerateStatesAndPresetsFromDerivedComponent' if (m_CopyStates && !string.IsNullOrEmpty(m_StatePath)) { vp_EditorUtility.GenerateStatesAndPresetsFromDerivedComponent(fpController, cController, m_StatePath); } } // convert weapon handler vp_FPWeaponHandler fpWHandler = target.GetComponent <vp_FPWeaponHandler>(); if (fpWHandler != null) { vp_WeaponHandler wHandler = target.AddComponent <vp_WeaponHandler>(); vp_EditorUtility.CopyValuesFromDerivedComponent(fpWHandler, wHandler, true, false, null); } // convert damage handler vp_FPPlayerDamageHandler fpDHandler = target.GetComponent <vp_FPPlayerDamageHandler>(); if (fpDHandler != null) { vp_PlayerDamageHandler dHandler = target.AddComponent <vp_PlayerDamageHandler>(); vp_EditorUtility.CopyValuesFromDerivedComponent(fpDHandler, dHandler, true, true, null); } // convert event handler vp_FPPlayerEventHandler fpEHandler = target.GetComponent <vp_FPPlayerEventHandler>(); if (fpEHandler != null) { vp_PlayerEventHandler eHandler = target.AddComponent <vp_PlayerEventHandler>(); vp_EditorUtility.CopyValuesFromDerivedComponent(fpEHandler, eHandler, true, false, null); } // convert body animator vp_FPBodyAnimator fpBAnimator = target.GetComponentInChildren <vp_FPBodyAnimator>(); if (fpBAnimator != null) { vp_BodyAnimator bAnimator = fpBAnimator.gameObject.AddComponent <vp_BodyAnimator>(); vp_EditorUtility.CopyValuesFromDerivedComponent(fpBAnimator, bAnimator, true, true, null); } // delete 'remoteplayer-illegal' components DeleteComponentsOfType(target.transform, typeof(vp_FPCamera)); // these first due to dependencies DeleteComponentsOfType(target.transform, typeof(vp_FPController)); // these first due to dependencies DeleteComponentsOfTypes(target.transform, new System.Type[] { typeof(Camera), typeof(AudioListener), typeof(vp_FPInput), typeof(vp_SimpleCrosshair), typeof(vp_FootstepManager), typeof(vp_FPInteractManager), typeof(vp_SimpleHUD), typeof(vp_PainHUD), typeof(vp_FPEarthquake), typeof(CharacterController), typeof(vp_FPWeaponHandler), typeof(vp_FPPlayerDamageHandler), typeof(vp_FPPlayerEventHandler), typeof(vp_FPBodyAnimator) }); Transform weaponCamera = vp_Utility.GetTransformByNameInChildren(target.transform, "WeaponCamera", true); if (weaponCamera != null) { GameObject.DestroyImmediate(weaponCamera.gameObject); } target.name = name; } catch (System.Exception e) { Debug.Log(e); target.name = target.name + " (CONVERSION FAILED - see error log)"; } }
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> 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)); }
// 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); } }
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(); }
void Awake() { bridge = GetComponent <FPPlayerLuaBridge>(); fpController = GetComponentInChildren <vp_FPController>(); fpCamera = GetComponentInChildren <vp_FPCamera>(); }