Ejemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (this.fuelReady && other.CompareTag("Player"))
        {
            Submarine submarine = other.gameObject.GetComponent <Submarine>();
            if (submarine == null)
            {
                return;
            }

            if (this.gameObject.CompareTag("Fuel Top"))
            {
                spriteRenderer.sprite = fuelTopEmpty;
            }
            else if (this.gameObject.CompareTag("Fuel Bottom"))
            {
                spriteRenderer.sprite = fuelBottomEmpty;
            }

            submarine.IncreaseFuel(fuelIncreaseValue);
            this.fuelReady = false;
            StartCoroutine(respawnFuel());
        }
    }