Пример #1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Rocket")
        {
            RocketFly rocketScript = other.GetComponent <RocketFly>();
            if (rocketScript.fuel + value > 1f)
            {
                StartCoroutine(rocketScript.AddFuel(1 - rocketScript.fuel));
            }
            //rocketScript.fuel = 1f;
            else
            {
                StartCoroutine(rocketScript.AddFuel(value));
            }
            //rocketScript.fuel += value;

            rocketScript.countOfFuel++;
            Destroy(gameObject);
        }
    }