Example #1
0
    // Update is called once per frame
    void Update()
    {
        timer += Time.deltaTime;
        speedImage.fillAmount = pc.speed / pc.maxSpeed;

        if (age < 35)
        {
            if (((int)timer + 70) >= age * 5)
            {
                changeAge();
            }
        }
        else if (age < 60)
        {
            if (((int)timer - 65) >= age)
            {
                changeAge();
            }
        }
        else
        {
            if (!stop)
            {
                stop        = true;
                pc.movetype = PlayerControl.MoveType.Stop;
                pm.ActivateAll();

                string show = "";
                foreach (string s in life)
                {
                    show = show + s + "\n";
                }
                result.text = show;
                scrollView.SetActive(true);
            }
            if (startTime != 0f)
            {
                float speed = (Time.time - startTime) / 2f;
                c.position = Vector3.Lerp(startPosition, target.position, speed);
                c.rotation = Quaternion.Lerp(startrotation, target.rotation, speed);
            }
            else
            {
                startTime     = Time.time;
                startPosition = c.position;
                startrotation = c.rotation;
            }
        }
    }