Пример #1
0
    public void Update()
    {
        if (Lerping == true)
        {
            float disCovered = (Time.time - StartTime) * Speed;
            float ratio      = disCovered / Distance;

            transform.position = Vector3.Lerp(StartPos, TargetPos, ratio);
            teleportationBall.transform.position = transform.position;


            conObject.updateTeleportProgress(ratio);

            if (lookedATarget == false)
            {
                teleportationBall.transform.LookAt(TargetPos);
                lookedATarget = true;
            }

            if (ratio >= 1)
            {
                Lerping = false;

                transform.position = TargetPos;

                conObject.endTeleporting();

                gameObject.GetComponent <Player>().MeshRenderer.enabled = true;
                ObjectPool.getObjectPool().returnObject(teleportationBall);

                //TODO Bug für cam zurücksetzen zwischen meheren Lerps beheben...
                //ObjectPool.getObjectPool().getObject(ObjectPool.categorie.essential, (int)ObjectPool.essential.camera).GetComponent<justLook>().objectToLookAt = null;
            }
        }
    }