void Start() { animator = this.GetComponent <Animator>(); audioSource = this.GetComponent <AudioSource>(); if (this.transform.root) { character = this.transform.root.GetComponent <CharacterSystem>(); fpsController = this.transform.root.GetComponent <FPSController>(); if (character == null) { character = this.transform.root.GetComponentInChildren <CharacterSystem>(); } if (fpsController == null) { fpsController = this.transform.root.GetComponentInChildren <FPSController>(); } } else { character = this.transform.GetComponent <CharacterSystem>(); fpsController = this.transform.GetComponent <FPSController>(); } timeTemp = Time.time; if (AutoUse) { Use(); Debug.Log("Using"); } }
public void Attack() { Attacking = true; RaycastHit SwordHit; if (Physics.Raycast(headBone.transform.position, headBone.transform.forward, out SwordHit, HitDistance, RaycastMask)) { if (SwordHit.transform.tag == "Player") { FPSController ply = SwordHit.transform.GetComponent <FPSController>(); if (!ply.Blocking) { ply.HitDamaged(1); StartCoroutine(Knockback(SwordHit)); SoundOrigin = SoundSource.transform.localPosition; SoundSource.transform.position = SwordHit.point; EnemySounds.PlaySound(HitSound); SoundSource.transform.localPosition = SoundOrigin; GameObject ParticleEmitter = Instantiate(BloodEmitter, SwordHit.point, Quaternion.LookRotation(SwordHit.normal)); StartCoroutine(GCParticles(ParticleEmitter)); } else { SoundOrigin = SoundSource.transform.localPosition; SoundSource.transform.position = SwordHit.point; EnemySounds.PlaySound(BlockSound); SoundSource.transform.localPosition = SoundOrigin; GameObject ParticleEmitter = Instantiate(DustEmitter, SwordHit.point, Quaternion.LookRotation(SwordHit.normal)); StartCoroutine(GCParticles(ParticleEmitter)); } } } }
void Start() { _collider = GetComponent <Collider>(); _fpsController = GetComponent <FPSController>(); _characterController = GetComponent <CharacterController>(); _gameSceneManager = GameSceneManager.instance; _aiBodyPartLayer = LayerMask.NameToLayer("AI Body Part"); _interactiveMask = 1 << LayerMask.NameToLayer("Interactive"); if (_gameSceneManager != null) { PlayerInfo info = new PlayerInfo(); info.camera = _camera; info.characterManager = this; info.collider = _collider; info.meleeTrigger = _meleeTrigger; _gameSceneManager.RegisterPlayerInfo(_collider.GetInstanceID(), info); } //Get rid of mouse cursor Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; if (_playerHUD) { _playerHUD.Fade(2.0f, ScreenFadeType.FadeIn); } }
// Start is called before the first frame update void Start() { playerController = gameObject.AddComponent <FPSController>(); PlayerTransform = gameObject.GetComponent <Transform>(); PlayerRadius = gameObject.GetComponent <SphereCollider>().bounds.size.y / 2; PlayerColliderBounds = gameObject.GetComponent <SphereCollider>().bounds.size; }
void Update() { if (UnitZ.playerManager.PlayingCharacter != null) { SetVisible(true); FPSController fpsControl = UnitZ.playerManager.PlayingCharacter.GetComponent <FPSController>(); if (fpsControl) { MouseLock.IsMobileControl = true; fpsControl.MoveCommand(new Vector3(CnInputManager.GetAxis("Horizontal"), 0, CnInputManager.GetAxis("Vertical")), CnInputManager.GetButton("Jump")); fpsControl.Aim(new Vector2(CnInputManager.GetAxis("Touch X") * AimSensitivity, CnInputManager.GetAxis("Touch Y") * AimSensitivity)); fpsControl.Trigger1(CnInputManager.GetButton("Touch Fire1")); /*fpsControl.Trigger2(CnInputManager.GetButtonDown("Fire2")); * * if (CnInputManager.GetButtonDown("Fire3")) * { * fpsControl.OutVehicle(); * fpsControl.Interactive(); * } * * if (CnInputManager.GetButtonDown("Submit")) * { * fpsControl.Reload(); * }*/ fpsControl.Checking(); } } else { SetVisible(false); } }
/// <summary> /// 执行关卡task /// </summary> private void OnStageTaskUpdate() { if (_curStageTask.isFinish != true) { if (!_curStageTask.isStarted) { // 设置fixedFPS if (_curStageInfo.fixedFps) { Application.targetFrameRate = 90; } else { Application.targetFrameRate = 60; } FPSController.GetInstance().Restart(_curStageInfo.fixedFps); // bgm开始播放 //SoundManager.GetInstance().SetSoundPlayTime(_curStageInfo.bgm, 0); SoundManager.GetInstance().ResumeAllSTGSound(); //SoundManager.GetInstance().PrintSoundTime("DarkRoad"); InterpreterManager.GetInstance().AddPara(ExtraTaskManager.GetInstance(), LuaParaType.LightUserData); InterpreterManager.GetInstance().CallTaskCoroutine(_curStageTask, 1); } else { InterpreterManager.GetInstance().CallTaskCoroutine(_curStageTask); } } }
private void Start() { m_Agent = GetComponentInChildren<NavMeshAgent>(); m_Character = GetComponent<FPSController>(); m_Agent.updateRotation = true; m_Agent.updatePosition = true; }
void Start() { upperBody = transform.GetChild(1); hand = upperBody.GetChild(0); fps = GetComponent <FPSController>(); statusEffects = new List <StatusEffect>(); currentItem = 0; health = maxHealth; energy = maxEnergy; vulnerable = true; alive = true; InventoryController bagInventoryContr; InventoryController[] ics = GetComponents <InventoryController>(); if (ics[0].inventoryName == "Hand") { handInventoryContr = ics[0]; bagInventoryContr = ics[1]; } else { handInventoryContr = ics[1]; bagInventoryContr = ics[0]; } handInventory.inventoryController = handInventoryContr; bagInventory.inventoryController = bagInventoryContr; EquipCurrentItem(); handInventoryContr.inventoryChangeDelegate += OnInventoryChange; }
void Start() { if (GetComponent <Animation>()) { GetComponent <Animation>().cullingType = AnimationCullingType.AlwaysAnimate; } FPSmotor = transform.root.GetComponentInChildren <FPSController>(); Zooming = false; if (GetComponent <AudioSource>()) { audiosource = GetComponent <AudioSource>(); } if (NormalCamera) { fovTemp = NormalCamera.GetComponent <Camera>().fieldOfView; } if (!this.InfinityAmmo) { AmmoPack = Player.CurrentUser.GetMaterialCount(id); } if (AmmoIn > 1) { AmmoIn = 1; } }
void Start() { animator = this.GetComponent <Animator>(); audioSource = this.GetComponent <AudioSource>(); if (this.transform.root) { character = this.transform.root.GetComponent <CharacterSystem>(); fpsController = this.transform.root.GetComponent <FPSController>(); if (character == null) { character = this.transform.root.GetComponentInChildren <CharacterSystem>(); } if (fpsController == null) { fpsController = this.transform.root.GetComponentInChildren <FPSController>(); } } else { character = this.transform.GetComponent <CharacterSystem>(); fpsController = this.transform.GetComponent <FPSController>(); } timeTemp = Time.time; if (ItemIndicator) { preplacingObject = (GameObject)GameObject.Instantiate(ItemIndicator.gameObject, this.transform.position, ItemIndicator.transform.rotation); } }
// Update is called once per frame void Update() { FPSController.GetInstance().SleepToNextFrame(); //if (_isFirst) //{ // _isFirst = false; // _lastFrameTime = TimeUtil.GetTimestamp(); //} //else //{ // long curFrameTime = TimeUtil.GetTimestamp(); // Logger.Log("FrameDuration = " + 1000f * (curFrameTime - _lastFrameTime) / 10000000); // _lastFrameTime = curFrameTime; //} _fsm.Update(); TimerManager.GetInstance().Update(); TweenManager.GetInstance().Update(); UIManager.GetInstance().Update(); SoundManager.GetInstance().Update(); // 销毁检测 if (Global.SysBusyValue < Consts.SysBusyValue) { ObjectsPool.GetInstance().CheckDestroyPoolObjects(); if (Global.SysBusyValue == 0) { ObjectsPool.GetInstance().DestroyProtoTypes(); } } }
void Awake() { refUI = FindObjectOfType <UI>(); refMovement = FindObjectOfType <Movement>(); refGC = FindObjectOfType <GunController>(); refFPS = FindObjectOfType <FPSController>(); }
/// <summary> /// 重置FPS计数器 /// <para>fixedFPS 是否自动补帧</para> /// </summary> /// <param name="luaState"></param> /// <returns></returns> public static int ResetFPSTimer(ILuaState luaState) { bool fixedFPS = luaState.ToBoolean(-1); FPSController.GetInstance().Restart(fixedFPS); return(0); }
void Awake() { dead = false; uim = GameObject.Find ("UserInterface").GetComponent<UserInterfaceManager>(); fpsc = gameObject.GetComponent<FPSController> (); csc = GetComponentInChildren<CharacterSoundController>(); }
// Use this for initialization void Start() { this.CameraController_ = this.transform.FindChild("Main Camera").gameObject.GetComponent <CameraController>(); this.Fire_ = this.GetComponent <FPSFire> (); this.Controller_ = this.GetComponent <FPSController>(); this.GunAnimator_ = GameObject.Find("M4A1 Sopmod").GetComponent <Animator>(); }
public override void OnInspectorGUI() { FPSController fps = (FPSController)target; EditorGUILayout.LabelField("Speed", GuiStylesBank.boldStyle); fps.walkingSpeed = EditorGUILayout.Slider("Walking speed", fps.walkingSpeed, .1f, 20); fps.runningSpeed = EditorGUILayout.Slider("Running speed", fps.runningSpeed, .1f, 20); EditorGUILayout.Separator(); EditorGUILayout.LabelField("Jump", GuiStylesBank.boldStyle); fps.jumpSpeed = EditorGUILayout.Slider("Jump force", fps.jumpSpeed, .1f, 30); fps.gravity = EditorGUILayout.Slider("Gravity", fps.gravity, .1f, 30); EditorGUILayout.Separator(); EditorGUILayout.LabelField("Camera", GuiStylesBank.boldStyle); fps.lookSpeed = EditorGUILayout.Slider("Look sensitivity", fps.lookSpeed, .1f, 30); fps.lookXLimit = EditorGUILayout.Slider("X clamping", fps.lookXLimit, .1f, 360); EditorGUILayout.Separator(); EditorGUILayout.LabelField("Control keys", GuiStylesBank.boldStyle); fps.runKey = (KeyCode)EditorGUILayout.EnumPopup("Running", fps.runKey); fps.jumpKey = (KeyCode)EditorGUILayout.EnumPopup("Jumping", fps.jumpKey); }
void Start() { terrain = FindObjectOfType <TerrainGenerator> (); cam = Camera.main.transform; controller = FindObjectOfType <FPSController> (); if (!Application.isEditor) { //infiniteSeedMode = false; } numSeedsByType = new int[seeds.Length]; // TEST: if (debug_autoPlantSeeds) { int n = 0; for (int i = 0; i < 100; i++) { if (n > 30) { break; } Vector3 spawnPos = Random.insideUnitSphere * 20; float terrainHeight = terrain.GetHeight(new Vector2(spawnPos.x, spawnPos.z)); if (spawnPos.y > terrainHeight) { n++; Instantiate(seeds[0], spawnPos, plantHandPos.rotation); } } } }
void Start() { _jump = gameObject.GetComponent <FPSController>(); _hp = gameObject.GetComponent <PlayerHealth>(); shotScript = gameObject.GetComponent <PlayerShoot>(); puTimer = puReset; }
void Awake() { SoundSource = GetComponent <AudioSource>(); if (GetComponent <FPSController>() != null) { ply = GetComponent <FPSController>(); } }
public void PauseGame() { AudioListener.pause = true; GamePaused = true; FPSController.SetCursorLocked(false); Time.timeScale = 0f; PauseCanvas.SetActive(true); }
public void ResumeGame() { AudioListener.pause = false; FPSController.SetCursorLocked(true); GamePaused = false; Time.timeScale = 1f; PauseCanvas.SetActive(false); }
private void OnTriggerExit(Collider other) { if (other.CompareTag("Player")) { fps = other.GetComponent <FPSController>(); fps.jumpSpeed = oldJump; } }
public static FPSController GetInstance() { if (_instance == null) { _instance = new FPSController(); } return(_instance); }
// Use this for initialization void Start() { m_Anim = GetComponent <Animator>(); m_PlayerAnim = GetComponentInParent <PlayerAnimator>(); m_Controller = GetComponentInParent <FPSController>(); //Wait a frame to stop the overlap between IKFree on destroy and IKInit on start; StartCoroutine("Init"); }
private void OnCollisionEnter(Collision collision) { if (collision.collider.tag == "Player") { a = collision.gameObject.GetComponent <FPSController>(); a.Damage(this.tag); } }
void Start() { fps = FindObjectOfType <FPSController>(); Time.timeScale = 1f; _hp.text = "HP: " + hp; _killCount.text = "Kill Count: " + killCount; StartCoroutine(FindObjectOfType <SceneFader>().Fade(SceneFader.FadeDirection.Out)); }
void Start() { if (this.transform.root) { fpsController = this.transform.root.GetComponent<FPSController> (); } else { fpsController = this.transform.GetComponent<FPSController> (); } }
void OnTriggerEnter(Collider collider) { if (collider.tag == "Player") { FPSController.SetCursorLocked(false); SceneManager.LoadScene("Credits"); } }
void Start() { refGC = FindObjectOfType <GunController>(); refMovement = FindObjectOfType <Movement>(); refFPS = FindObjectOfType <FPSController>(); BulletCount(); TimeCounter(); }
// Use this for initialization void Start() { this.MazzleObject_ = Resources.Load("Prefabs/Effects/MuzzleFlash"); this.BulletObject_ = Resources.Load("Prefabs/Bullet"); this.FPSController_ = this.gameObject.GetComponent <FPSController> (); this.CameraController_ = this.transform.FindChild("Main Camera").gameObject.GetComponent <CameraController>(); this.FirePosition_ = this.transform.FindChild("FirePosition").gameObject; this.NowBulletNum_ = this.GunBulletNum_; }
void OnTriggerStay(Collider player) { FPSController fpsController = player.GetComponent <FPSController>(); if (fpsController) { fpsController.Climb(fpsController.inputDirection.z); } }
void SetInitialReferences() { playerMaster = GetComponent<Player_Master>(); gunAssemblyMaster = GetComponent<GunAssembly_Master>(); playerController = GetComponent<FPSController>(); firstPersonCameraFOV = FirstPersonCamera.fieldOfView; UICameraFOV = UICamera.fieldOfView; }
// Use this for initialization void Start() { startPosition = transform.position; this.GetComponent <Rigidbody>().velocity = fireDirection * travelSpeed; rb = GetComponent <Rigidbody>(); puScript = Camera.main.GetComponent <PickUp> (); player = Camera.main.transform.parent.GetComponent <FPSController>(); GameManager.instance.addCannonBall(this); }
/// <summary> /// Use this for initialisation. /// </summary> void Start() { anim = GetComponent <Animator>(); _AudioSource = GetComponent <AudioSource>(); fps1 = GameObject.FindObjectOfType <FPSController>(); shotgun = GameObject.FindObjectOfType <Shotgun>(); currentBullets = bulletsPerMag; wm = gameObject.GetComponentInParent(typeof(WeaponManager)) as WeaponManager; }
void SetInitialReferences() { gameManagerMaster = GameObject.Find("_GameManager").GetComponent<GameManager_Master>(); playerMaster = GetComponent<Player_Master>(); playerController = GetComponent<FPSController>(); playerRB = GetComponent<Rigidbody>(); playerCollider = GetComponent<CapsuleCollider>(); spawnPoints = FindObjectsOfType<NetworkStartPosition>(); }
// Use this for initialization void Start () { // Set target direction to the camera's initial orientation. targetDirection = transform.localRotation.eulerAngles; paused = GetComponent<PauseMenu>(); player = GetComponent<FPSController>(); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
void SetInitialReferences() { if (GameObject.Find("_GameManager").GetComponent<GameManager_Master>() != null) { gameManagerMaster = GameObject.Find("_GameManager").GetComponent<GameManager_Master>(); } playerMaster = GetComponent<Player_Master>(); playerController = GetComponent<FPSController>(); playerAnimator = GetComponent<Animator>(); playerRigidbody = GetComponent<Rigidbody>(); }
void Start() { animator = this.GetComponent<Animator> (); audioSource = this.GetComponent<AudioSource> (); if (this.transform.root) { character = this.transform.root.GetComponent<CharacterSystem> (); fpsController = this.transform.root.GetComponent<FPSController> (); if (character == null) character = this.transform.root.GetComponentInChildren<CharacterSystem> (); if (fpsController == null) fpsController = this.transform.root.GetComponentInChildren<FPSController> (); } else { character = this.transform.GetComponent<CharacterSystem> (); fpsController = this.transform.GetComponent<FPSController> (); } timeTemp = Time.time; }
// Use this for initialization void Start() { gunController = FindObjectOfType<GunController> (); fpsController = FindObjectOfType<FPSController> (); }
void Start() { if (GetComponent<Animation>()) GetComponent<Animation>().cullingType = AnimationCullingType.AlwaysAnimate; FPSmotor = transform.root.GetComponentInChildren<FPSController> (); Zooming = false; if (GetComponent<AudioSource>()) { audiosource = GetComponent<AudioSource>(); } if (NormalCamera) fovTemp = NormalCamera.GetComponent<Camera>().fieldOfView; if (AmmoIn > 1) AmmoIn = 1; }
void Start() { reloading = false; animator = this.GetComponent<Animator> (); audioSource = this.GetComponent<AudioSource> (); if (this.transform.root) { character = this.transform.root.GetComponent<CharacterSystem> (); fpsController = this.transform.root.GetComponent<FPSController> (); if (character == null) character = this.transform.root.GetComponentInChildren<CharacterSystem> (); if (fpsController == null) fpsController = this.transform.root.GetComponentInChildren<FPSController> (); } else { character = this.transform.GetComponent<CharacterSystem> (); fpsController = this.transform.GetComponent<FPSController> (); } if (character) character.DamageSound = DamageSound; if (fpsController) fpsController.zooming = false; Hide (true); timeTemp = Time.time; StyleManager style = (StyleManager)GameObject.FindObjectOfType (typeof(StyleManager)); if (style && !Skin) { Skin = style.GetSkin (0); } if (animator) { animationSpeedTemp = animator.speed; } }
void Start() { animator = this.GetComponent<Animator> (); audioSource = this.GetComponent<AudioSource> (); if (this.transform.root) { character = this.transform.root.GetComponent<CharacterSystem> (); fpsController = this.transform.root.GetComponent<FPSController> (); if (character == null) character = this.transform.root.GetComponentInChildren<CharacterSystem> (); if (fpsController == null) fpsController = this.transform.root.GetComponentInChildren<FPSController> (); } else { character = this.transform.GetComponent<CharacterSystem> (); fpsController = this.transform.GetComponent<FPSController> (); } timeTemp = Time.time; if (ItemIndicator) { preplacingObject = (GameObject)GameObject.Instantiate (ItemIndicator.gameObject, this.transform.position, ItemIndicator.transform.rotation); } }
void Awake() { FPSmotor = GetComponent<FPSController> (); gunHanddle = GetComponent<GunHanddle> (); }
void Start() { FPSmotor = GetComponent<FPSController> (); Driver = GetComponent<CharacterDriver>(); Application.targetFrameRate = 60; }