void Start()
 {
     S        = this;
     level    = 0;
     levelMax = barriers.Length;
     StartLevel();
 }
Beispiel #2
0
    void Update()
    {
        if (!aimingMode)
        {
            return;
        }
        Vector3 mousePos2D = Input.mousePosition;

        mousePos2D.z = -Camera.main.transform.position.z;
        Vector3 mousePos3D   = Camera.main.ScreenToWorldPoint(mousePos2D);
        Vector3 mouseDelta   = mousePos3D - launchPos;
        float   maxMagnitude = this.GetComponent <SphereCollider>().radius;

        if (mouseDelta.magnitude > maxMagnitude)
        {
            mouseDelta.Normalize();
            mouseDelta *= maxMagnitude;
        }
        Vector3 projPos = launchPos + mouseDelta;

        Pinball.transform.position = projPos;
        if (Input.GetMouseButtonUp(0))
        {
            aimingMode = false;
            PinballRigidbody.isKinematic = false;
            PinballRigidbody.velocity    = -mouseDelta * velocityMult;
            Pinball = null;
            PinpointPinball.LivesLost();
            PinballProjection.S.poi = Pinball;
        }
    }
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Pickup"))
     {
         other.gameObject.SetActive(false);
         PinpointPinball.LivesGained();
     }
 }