Beispiel #1
0
    //When a block is let go, cast rays up and down to check whether the block was put on top of another block. If it wasn't, the player has lost. Otherwise, he scored a point.
    public void OnBlockDetachFromHand()
    {
        RaycastHit hit;

        if ((Physics.Raycast(transform.position, Vector3.down, out hit, detectionLength)) || (Physics.Raycast(transform.position, Vector3.up, out hit, detectionLength)))
        {
            if (hit.collider.tag == "Block")
            {
                scoreScript.Invoke("IncrementScore", 0);
            }
            else
            {
                scoreScript.Invoke("SetLost", 0);
            }
        }
    }
Beispiel #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Block")
     {
         Debug.Log("detected block on ground");
         scoreScript.Invoke("SetLost", 0);
     }
 }