using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[ExecuteAlways]
public class RacerScript : MonoBehaviour {

	public KartController kart;
	public ForwardRocketScript rocket;
	public FakeItemBoxScript fakeItem;
	public BoostRocketScript boost;
	public ItemCanvas itemCanvas;
	public bool hasItem;

    // Start is called before the first frame update
    void Start() {
		itemCanvas = GameObject.FindObjectOfType<ItemCanvas> ();
        
    }

    // Update is called once per frame
    void Update() {
		if (!itemCanvas) {
			itemCanvas = GameObject.FindObjectOfType<ItemCanvas> ();
			return;
		}

    }

	public void SetActiveItem (int itemNum) {
		if (itemNum == 0) {
			rocket.enabled = true;
		} else if (itemNum == 1) {
			fakeItem.enabled = true;
		} else if (itemNum == 2) {
			boost.enabled = true;
		} else {
			rocket.enabled = false;
			fakeItem.enabled = false;
			boost.enabled = false;
		}
	}
}
