private void OnEnable() { m_ProjectileBase = GetComponent <ProjectileBase>(); DebugUtility.HandleErrorIfNullGetComponent <ProjectileBase, ProjectileChargeParameters>(m_ProjectileBase, this, gameObject); m_ProjectileBase.onShoot += OnShoot; }
void Start() { m_Objective = GetComponent <Objective>(); DebugUtility.HandleErrorIfNullGetComponent <Objective, ObjectiveKillEnemies>(m_Objective, this, gameObject); m_EnemyManager = FindObjectOfType <EnemyManager>(); DebugUtility.HandleErrorIfNullFindObject <EnemyManager, ObjectiveKillEnemies>(m_EnemyManager, this); m_EnemyManager.onRemoveEnemy += OnKillEnemy; if (mustKillAllEnemies) { killsToCompleteObjective = m_EnemyManager.numberOfEnemiesTotal; } // set a title and description specific for this type of objective, if it hasn't one if (string.IsNullOrEmpty(m_Objective.title)) { m_Objective.title = "Eliminate " + (mustKillAllEnemies ? "all the" : killsToCompleteObjective.ToString()) + " enemies"; } if (string.IsNullOrEmpty(m_Objective.description)) { m_Objective.description = GetUpdatedCounterAmount(); } }
void Start() { CharacterStatsController stats = GetComponent <CharacterStatsController>(); DebugUtility.HandleErrorIfNullGetComponent <CharacterStatsController, EnemyManager>(stats, this, gameObject); stats.onHealthChanged += HookDamage; }
void OnWeaponChanged(WeaponController newWeapon) { if (newWeapon) { CrosshairImage.enabled = true; m_CrosshairDataDefault = newWeapon.CrosshairDataDefault; m_CrosshairDataTarget = newWeapon.CrosshairDataTargetInSight; m_CrosshairRectTransform = CrosshairImage.GetComponent <RectTransform>(); DebugUtility.HandleErrorIfNullGetComponent <RectTransform, CrosshairManager>(m_CrosshairRectTransform, this, CrosshairImage.gameObject); } else { if (NullCrosshairSprite) { CrosshairImage.sprite = NullCrosshairSprite; } else { CrosshairImage.enabled = false; } } UpdateCrosshairPointingAtEnemy(true); }
void Start() { if (online) { m_Weapon_p = GetComponent <WeaponController_Photon>(); DebugUtility.HandleErrorIfNullGetComponent <WeaponController_Photon, WeaponFuelCellHandler>(m_Weapon_p, this, gameObject); m_FuelCellsCooled = new bool[fuelCells.Length]; for (int i = 0; i < m_FuelCellsCooled.Length; i++) { m_FuelCellsCooled[i] = true; } } else { m_Weapon = GetComponent <WeaponController>(); DebugUtility.HandleErrorIfNullGetComponent <WeaponController, WeaponFuelCellHandler>(m_Weapon, this, gameObject); m_FuelCellsCooled = new bool[fuelCells.Length]; for (int i = 0; i < m_FuelCellsCooled.Length; i++) { m_FuelCellsCooled[i] = true; } } }
private void OnEnable() { m_IteractiableBase = GetComponent <InteractableBase>(); DebugUtility.HandleErrorIfNullGetComponent <InteractableBase, InteractionSkillPickup>(m_IteractiableBase, this, gameObject); m_IteractiableBase.onInteract += OnInteract; }
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); }
public void RegisterObjective(Objective objective) { objective.onUpdateObjective += OnUpdateObjective; // instanciate the Ui element for the new objective GameObject objectiveUIInstance = objective.isOptional ? secondaryObjectivePrefab.getObject(true, objectivePanel.transform) : primaryObjectivePrefab.getObject(true, objectivePanel.transform); if (!objective.isOptional) { objectiveUIInstance.transform.SetSiblingIndex(0); } ObjectiveToast toast = objectiveUIInstance.GetComponent <ObjectiveToast>(); DebugUtility.HandleErrorIfNullGetComponent <ObjectiveToast, ObjectiveHUDManger>(toast, this, objectiveUIInstance.gameObject); // initialize the element and give it the objective description toast.Initialize(objective.title, objective.description, objective.GetUpdatedCounterAmount(), objective.isOptional, objective.delayVisible); m_ObjectivesDictionary.Add(objective, toast); if (showObjectivePanel) { objectivePanel.UpdateTable(toast.gameObject); } }
private void Start() { inter = GetComponent <Interact>(); 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; startingWeapons = startingWeapons.Where(x => x != null).ToList(); // Add starting weapons foreach (var weapon in startingWeapons) { AddWeapon(weapon); } SwitchWeapon(true); }
void Awake() { coolingEvent = FMODUnity.RuntimeManager.CreateInstance(CoolingCellsSound); var emissionModule = SteamVfx.emission; emissionModule.rateOverTimeMultiplier = 0f; m_OverheatingRenderersData = new List <RendererIndexData>(); foreach (var renderer in GetComponentsInChildren <Renderer>(true)) { for (int i = 0; i < renderer.sharedMaterials.Length; i++) { if (renderer.sharedMaterials[i] == OverheatingMaterial) { m_OverheatingRenderersData.Add(new RendererIndexData(renderer, i)); } } } m_OverheatMaterialPropertyBlock = new MaterialPropertyBlock(); m_SteamVfxEmissionModule = SteamVfx.emission; m_Weapon = GetComponent <WeaponController>(); DebugUtility.HandleErrorIfNullGetComponent <WeaponController, OverheatBehavior>(m_Weapon, this, gameObject); /*m_AudioSource = gameObject.AddComponent<AudioSource>(); * m_AudioSource.clip = CoolingCellsSound; * m_AudioSource.outputAudioMixerGroup = AudioUtility.GetAudioGroup(AudioUtility.AudioGroups.WeaponOverheat);*/ }
void Start() { // fetch components on the same gameObject m_Controller = GetComponent <CharacterController> (); DebugUtility.HandleErrorIfNullGetComponent <CharacterController, PlayerCharacterController> (m_Controller, this, gameObject); m_ClimbController = GetComponent <PlayerClimbController> (); DebugUtility.HandleErrorIfNullGetComponent <PlayerClimbController, PlayerCharacterController> (m_ClimbController, this, gameObject); m_WalkController = GetComponent <PlayerWalkController> (); DebugUtility.HandleErrorIfNullGetComponent <PlayerWalkController, PlayerCharacterController> (m_WalkController, 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); mainCamera = Camera.main; interactionText = GameObject.Find("InteractionCanvas/InteractionText").GetComponent <Text> (); m_Health.onDie += OnDie; // force the crouch state to false when starting SetCrouchingState(false, true); }
void Start() { m_PlayerInputsHandler = FindObjectOfType <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullFindObject <PlayerInputHandler, InGameMenuManager>(m_PlayerInputsHandler, this); m_PlayerHealth = m_PlayerInputsHandler.GetComponent <Health>(); DebugUtility.HandleErrorIfNullGetComponent <Health, InGameMenuManager>(m_PlayerHealth, this, gameObject); m_FramerateCounter = FindObjectOfType <FramerateCounter>(); DebugUtility.HandleErrorIfNullFindObject <FramerateCounter, InGameMenuManager>(m_FramerateCounter, this); menuRoot.SetActive(false); lookSensitivitySlider.value = m_PlayerInputsHandler.lookSensitivity; lookSensitivitySlider.onValueChanged.AddListener(OnMouseSensitivityChanged); shadowsToggle.isOn = QualitySettings.shadows != ShadowQuality.Disable; shadowsToggle.onValueChanged.AddListener(OnShadowsChanged); invincibilityToggle.isOn = m_PlayerHealth.invincible; invincibilityToggle.onValueChanged.AddListener(OnInvincibilityChanged); framerateToggle.isOn = m_FramerateCounter.uiText.gameObject.activeSelf; framerateToggle.onValueChanged.AddListener(OnFramerateCounterChanged); }
void Start() { // fetch components on the same gameObject m_Controller = GetComponent <CharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <CharacterController, IS_PlayerCharacterController>(m_Controller, this, gameObject); m_InputHandler = GetComponent <IS_PlayerInputHandler>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, IS_PlayerCharacterController>(m_InputHandler, this, gameObject); m_WeaponsManager = GetComponent <IS_PlayerWeaponsManager>(); DebugUtility.HandleErrorIfNullGetComponent <IS_PlayerWeaponsManager, IS_PlayerCharacterController>(m_WeaponsManager, this, gameObject); m_Health = GetComponent <Health>(); DebugUtility.HandleErrorIfNullGetComponent <Health, IS_PlayerCharacterController>(m_Health, this, gameObject); m_Actor = GetComponent <Actor>(); DebugUtility.HandleErrorIfNullGetComponent <Actor, IS_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() { timerActive = true; checkpoints.Add(transform.position); v.profile.TryGetSettings(out lensdis); v.profile.TryGetSettings(out vignett); v.profile.TryGetSettings(out chrome); // 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); wallRunComponent = GetComponent <WallRun>(); m_Controller.enableOverlapRecovery = true; // force the crouch state to false when starting SetCrouchingState(false, true); UpdateCharacterHeight(true); }
private void OnEnable() { m_ProjectileBase = GetComponent <ProjectileBase>(); DebugUtility.HandleErrorIfNullGetComponent <ProjectileBase, SpeedBoostSpell>(m_ProjectileBase, this, gameObject); m_ProjectileBase.onShoot += OnShoot; Destroy(gameObject, 1); }
// Start is called before the first frame update void Start() { m_Objective = GetComponent <Objective>(); DebugUtility.HandleErrorIfNullGetComponent <Objective, ObjectiveKillEnemies>(m_Objective, this, gameObject); health = objectiveEnemy.GetComponent <Health>(); health.onDie += CompleteObjective; }
void OnShoot() { CharacterStatsController statsController = m_ProjectileBase.owner.GetComponent <CharacterStatsController>(); DebugUtility.HandleErrorIfNullGetComponent <CharacterStatsController, SpeedBoostSpell>(statsController, this, gameObject); statsController.moveSpeed.AddTemporaryModifier(speed, duration); }
private void Start() { m_Collider = GetComponent <Collider>(); DebugUtility.HandleErrorIfNullGetComponent <Collider, Pickup>(m_Collider, this, gameObject); // ensure the physics setup is a kinematic rigidbody trigger m_Collider.isTrigger = true; }
// Start is called before the first frame update void Start() { m_PlayerCharacterController = GetComponent <PlayerCharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, PlayerInputHandler>(m_PlayerCharacterController, this, gameObject); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
void Awake() { m_CurrentAmmo = maxAmmo; m_LastMuzzlePosition = weaponMuzzle.position; m_ShootAudioSource = GetComponent <AudioSource>(); DebugUtility.HandleErrorIfNullGetComponent <AudioSource, WeaponController>(m_ShootAudioSource, this, gameObject); }
void Start() { m_Pickup = GetComponent <Pickup>(); DebugUtility.HandleErrorIfNullGetComponent <Pickup, GravityPickup>(m_Pickup, this, gameObject); // Subscribe to pickup action m_Pickup.onPick += OnPicked; }
private void Start() { m_CharacterStatsController = character.GetComponent <CharacterStatsController>(); DebugUtility.HandleErrorIfNullGetComponent <CharacterStatsController, HealthBarController>(m_CharacterStatsController, this, gameObject); SetHealthBarMaxValue(m_CharacterStatsController.maxHealth.GetValue()); m_CharacterStatsController.onHealthChanged += HandleHealthChange; }
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() { m_Health = GetComponent <Health>(); DebugUtility.HandleErrorIfNullGetComponent <Health, Destructable>(m_Health, this, gameObject); // Subscribe to damage & death actions m_Health.onDie += OnDie; m_Health.onDamaged += OnDamaged; }
private void Start() { PlayerCharacterController playerCharacterController = GameObject.FindObjectOfType <PlayerCharacterController> (); DebugUtility.HandleErrorIfNullFindObject <PlayerCharacterController, PlayerHealthBar> (playerCharacterController, this); m_PlayerHealth = playerCharacterController.GetComponent <Health> (); DebugUtility.HandleErrorIfNullGetComponent <Health, PlayerHealthBar> (m_PlayerHealth, this, playerCharacterController.gameObject); }
private void OnEnable() { m_ProjectileBase = GetComponent <ProjectileBase>(); DebugUtility.HandleErrorIfNullGetComponent <ProjectileBase, ProjectileStandard>(m_ProjectileBase, this, gameObject); m_ProjectileBase.onShoot += OnShoot; Destroy(gameObject, maxLifeTime); }
void Start() { // get pickup component on same instance m_Pickup = GetComponent <Pickup>(); DebugUtility.HandleErrorIfNullGetComponent <Pickup, HealthPickup>(m_Pickup, this, gameObject); // Subscribe to pickup action m_Pickup.onPick += OnPicked; }
private void Start() { m_PlayerCharacterController = GetComponent <PlayerCharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, PlayerInputHandler>(m_PlayerCharacterController, this, gameObject); m_GameFlowManager = FindObjectOfType <GameFlowManager>(); DebugUtility.HandleErrorIfNullFindObject <GameFlowManager, PlayerInputHandler>(m_GameFlowManager, this); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
private void LateUpdate() { m_PlayerCharacterController = GetComponent <PlayerCharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, PlayerInputHandler>(m_PlayerCharacterController, this, gameObject); m_GameFlowManager = FindObjectOfType <GameFlowManager>(); DebugUtility.HandleErrorIfNullFindObject <GameFlowManager, PlayerInputHandler>(m_GameFlowManager, this); m_FireInputWasHeld = GetFireInputHeld(); }
protected override void Start() { base.Start(); m_AudioSource = GetComponent <AudioSource>(); DebugUtility.HandleErrorIfNullGetComponent <AudioSource, EnemyMobile>(m_AudioSource, this, gameObject); m_CurrentScreenMaterial = m_TVRenderer.material; SetScreenTextures(m_IdleTexture, m_IdleEmissionTexture); }