void Start() { // fetch components on the same gameObject m_Controller = GetComponent <CharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <CharacterController, PlayerCharacterController>(m_Controller, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerCharacterController>(m_InputHandler, this, gameObject); m_WeaponsManager = GetComponent <PlayerWeaponsManager>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerWeaponsManager, PlayerCharacterController>( m_WeaponsManager, this, gameObject); m_Health = GetComponent <Health>(); DebugUtility.HandleErrorIfNullGetComponent <Health, PlayerCharacterController>(m_Health, this, gameObject); m_Actor = GetComponent <Actor>(); DebugUtility.HandleErrorIfNullGetComponent <Actor, PlayerCharacterController>(m_Actor, this, gameObject); m_Controller.enableOverlapRecovery = true; m_Health.OnDie += OnDie; // force the crouch state to false when starting SetCrouchingState(false, true); UpdateCharacterHeight(true); }
void Start() { ActiveWeaponIndex = -1; m_WeaponSwitchState = WeaponSwitchState.Down; m_InputHandler = GetComponent <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerWeaponsManager>(m_InputHandler, this, gameObject); m_PlayerCharacterController = GetComponent <PlayerCharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, PlayerWeaponsManager>( m_PlayerCharacterController, this, gameObject); SetFov(DefaultFov); OnSwitchedToWeapon += OnWeaponSwitched; // Add starting weapons foreach (var weapon in StartingWeapons) { AddWeapon(weapon); } SwitchWeapon(true); }
void Start() { m_PlayerCharacterController = GetComponent <PlayerCharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, Treasure>(m_PlayerCharacterController, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, Treasure>(m_InputHandler, this, gameObject); }
void Start() { jetpackEvent = FMODUnity.RuntimeManager.CreateInstance(JetpackSfx); IsJetpackUnlocked = IsJetpackUnlockedAtStart; m_PlayerCharacterController = GetComponent <PlayerCharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, Jetpack>(m_PlayerCharacterController, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, Jetpack>(m_InputHandler, this, gameObject); CurrentFillRatio = 1f; }
void Start() { IsJetpackUnlocked = IsJetpackUnlockedAtStart; m_PlayerCharacterController = GetComponent <PlayerCharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, Jetpack>(m_PlayerCharacterController, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, Jetpack>(m_InputHandler, this, gameObject); CurrentFillRatio = 1f; AudioSource.clip = JetpackSfx; AudioSource.loop = true; }