Exemple #1
0
 void Start()
 {
     _audioSource       = GetComponent <AudioSource>();
     _shootSound        = _audioSource.clip;
     rb                 = GetComponent <Rigidbody>();
     tf                 = GetComponent <Transform>();
     bp                 = GetComponent <BatteryPower>();
     powerLevelCylinder = bp.GetComponent <Transform>();
 }
Exemple #2
0
 private void OnTriggerExit(Collider other)
 {
     if (other.tag == "ChargeAble" || other.tag == "Player")
     {
         _charging = false;
         if (Battery_1 == other.GetComponent <BatteryPower>())
         {
             Battery_1 = null;
         }
         else
         {
             Battery_2 = null;
         }
     }
 }
Exemple #3
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "ChargeAble" || other.tag == "Player")
     {
         _charging = true;
         if (Battery_1 == null)
         {
             Battery_1 = other.GetComponent <BatteryPower>();
         }
         else
         {
             Battery_2 = other.GetComponent <BatteryPower>();
         }
         StartCoroutine("Charge");
     }
 }
Exemple #4
0
    void CheckBatteryPower()
    {
        int curBatteryValue = GetCurrentBatteryValue();

        if (curBatteryValue != OldBatteryValue)
        {
            int          percentNum      = Mathf.CeilToInt(((float)curBatteryValue / MaxBatteryValue) * 100);
            BatteryPower curBatteryPower = GetBatteryPower(curBatteryValue);

            if (BatteryValueChangeCallback != null)
            {
                BatteryValueChangeCallback(percentNum, curBatteryPower);
            }

            OldBatteryValue = curBatteryValue;
        }
    }
Exemple #5
0
 private void Awake()
 {
     instance = this;
 }
 private void BatteryValueChange(int percentNum, BatteryPower batteryPower)
 {
     SetBattery(percentNum);
     SetBatteryPower(percentNum);
 }