/// <summary> /// Use this method for a successful attack from a monster /// </summary> /// <param name="monster">The monster that attacked</param> public void AttackedByMonster(GameObject monster) { Monsters.Remove(monster); currentLife--; FlashlightManager flashlightManager = gameObject.GetComponent(typeof(FlashlightManager)) as FlashlightManager; flashlightManager.ReduceIntensity(); }
private void OnTriggerEnter(Collider other) { FlashlightManager flashlight = playerWithFlashlight.GetComponent <FlashlightManager>(); if (!flashlight.IsBatteryFull()) { flashlight.RestoreHealth(1); Destroy(gameObject); } }
private void Start() { player = GameObject.FindGameObjectWithTag("Player"); grapple = player.GetComponent <GrapplingManager>(); flashlightManager = player.GetComponent <FlashlightManager>();//gets flashlight and grapple }