void OnCollisionEnter(Collision col)
    {
        float colForce = drone.rb.velocity.magnitude;

        print(colForce);

        if (colForce > collisionThreshold)
        {
            drone.ThrusterUpdate(-Mathf.RoundToInt(colForce * damageFactor), thrusterID);

            rb.AddExplosionForce(colForce * 10, col.GetContact(0).point, 10);

            print("Hit " + thrusterID + " " + colForce);
        }
    }
Beispiel #2
0
    private void OnTriggerStay(Collider other)
    {
        if (other.CompareTag("Player") && other != null)
        {
            other.GetComponentInParent <DroneEnergyTank>().RegenEnergy(droneChargeRate * Time.deltaTime);

            DroneHealth droneHealth = other.GetComponentInParent <DroneHealth>();

            for (int i = 0; i < droneHealth.propellerHealth.Length; i++)
            {
                droneHealth.ThrusterUpdate(droneChargeRate, i);
            }



            HealBase(other.GetComponentInParent <DroneController>().DropOffEnergy());
        }
    }