void Awake() { controller = GetComponent<CharacterController>(); energyAbsorb = GetComponent<EnergyAbsorber>(); energySor = GetComponent<EnergySource>(); target = PickTarget(); PickIdleTarget(); }
void Awake() { energySource = GetComponent<EnergySource>(); energyAbsorber = GetComponent<EnergyAbsorber>(); energySource.energyType = outputEnergyType; if ( ! energyAbsorber.energyAbsorbed.ContainsKey( inputEnergyType ) ) energyAbsorber.energyAbsorbed.Add( inputEnergyType, 0 ); }
private void OnTriggerStay(Collider other) { // If the enemy stays in the area of the lightspot if (other.CompareTag("Lightspot")) { EnergyAbsorber ea = other.GetComponent <EnergyAbsorber>(); // Decrease enemy healtpoints by lightspot intensity power healthPoints -= Time.deltaTime * ea.Intensity; // If enemy has no healthpoints, then, destroy it if (healthPoints <= 0) { Destroy(gameObject); } } }
// Use this for initialization void Start() { energyAbsorber = GetComponent<EnergyAbsorber>(); }