Example #1
0
    private void Update()
    {
        if (Input.GetButtonDown("UseItem") && HasPickUp)
        {
            Debug.Log("Item used");
            ItemUI.text = "";
            HasPickUp   = false;
            switch (ItemNumb)
            {
            case 0:
                ThisKart.Boost();
                break;

            case 1:
                Instantiate(ItemList.GetTrap(), (Sphere.transform.position - transform.forward * 4f), Normal.transform.rotation);
                break;

            case 2:
                Vector3 rot = Normal.transform.eulerAngles;
                rot = new Vector3(rot.x * -1, rot.y + 180, rot.z);
                var MissileRot = Quaternion.Euler(rot);
                Instantiate(ItemList.GetUnguidedMissile(), (Sphere.transform.position + transform.forward * 2f), MissileRot);
                break;
            }
        }
    }
Example #2
0
    IEnumerator UnguidedMissile()
    {
        CoroutineRunning = true;
        yield return(new WaitForSeconds(Random.Range(0.1f, 2.5f)));

        Vector3 rot = Normal.transform.eulerAngles;

        rot = new Vector3(rot.x * -1, rot.y + 180, rot.z);
        var MissileRot = Quaternion.Euler(rot);

        Instantiate(ItemList.GetUnguidedMissile(), (Sphere.transform.position + transform.forward * 2f), MissileRot);
        CoroutineRunning = true;
        HasPickUp        = false;
    }