示例#1
0
    IEnumerator Grow()
    {
        float          TransitionSpeed = 0.1f;
        KartController KC           = this.transform.GetComponent <ItemInvoker>().KC;
        float          StartingMass = KC.GetComponent <Rigidbody>().mass;

        KC.GetComponent <Rigidbody>().mass = StartingMass * Scale;
        Vector3 StartingScale = Vector3.one;
        Vector3 BigScale      = new Vector3(Scale, Scale, Scale);

        float Alpha = 0f;

        while (Alpha < 1f)
        {
            Alpha += (Time.timeScale * TransitionSpeed);
            KC.transform.localScale = Vector3.Lerp(StartingScale, BigScale, GrowCurve.Evaluate(Alpha));
            yield return(null);
        }
        KC.transform.localScale = BigScale;

        yield return(new WaitForSeconds(Duration));

        KC.GetComponent <Rigidbody>().mass /= Scale;

        Alpha = 0f;
        while (Alpha < 1f)
        {
            Alpha += (Time.timeScale * TransitionSpeed);
            KC.transform.localScale = Vector3.Lerp(BigScale, StartingScale, GrowCurve.Evaluate(Alpha));
            yield return(null);
        }
        KC.transform.localScale = StartingScale;

        KC.ItemReference = null;
        Destroy(this.gameObject);
    }
    void Update()
    {
        if (Synced)
        {
            MPH.text = Mathf.Round(Synced.GetComponent <Rigidbody>().velocity.magnitude).ToString() + " MPH";

            Place.text = Synced.Place.ToString() + TextFormatter.GetPlaceSuffix(Synced.Place);

            Laps.text = (Synced.LapCount + 1).ToString() + "/" + M.RaceData.Laps;

            switch (Synced.InControl)
            {
            case KartController.Driver.AI: Player.text = "AI"; break;

            case KartController.Driver.Player1: Player.text = "P1"; break;

            case KartController.Driver.Player2: Player.text = "P2"; break;

            case KartController.Driver.Player3: Player.text = "P3"; break;

            case KartController.Driver.Player4: Player.text = "P4"; break;
            }

            Time.text = TextFormatter.GetTimeFormatted(M.SecondsPassed - Synced.LapOffset);

            CountDown.text = TextFormatter.GetCountDownFormatted(M.CountDown);

            if (Synced.LastLapTime != 0)
            {
                LapTime.text = TextFormatter.GetTimeFormatted(Synced.LastLapTime);
            }
            else
            {
                LapTime.text = "";
            }
        }
    }
示例#3
0
 void useWeapon()
 {
     itemAI.GetComponent <KartItemsController> ().UseItem();
     hasWeapon = false;
 }