예제 #1
0
 void Awake()
 {
     controller = GetComponent<CharacterController>();
     energyAbsorb = GetComponent<EnergyAbsorber>();
     energySor = GetComponent<EnergySource>();
     target = PickTarget();
     PickIdleTarget();
 }
예제 #2
0
    void Awake()
    {
        energySource = GetComponent<EnergySource>();
        energyAbsorber = GetComponent<EnergyAbsorber>();

        energySource.energyType = outputEnergyType;
        if ( ! energyAbsorber.energyAbsorbed.ContainsKey( inputEnergyType ) )
            energyAbsorber.energyAbsorbed.Add( inputEnergyType, 0 );
    }
예제 #3
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);
            }
        }
    }
예제 #4
0
 // Use this for initialization
 void Start()
 {
     energyAbsorber = GetComponent<EnergyAbsorber>();
 }