Beispiel #1
0
        void shoot()
        {
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out hit))
            {
                if (hit.collider != null)
                {
                    TargetView target = hit.collider.GetComponent <TargetView> ();
                    shootAudio();
                    if (target.getType() == lastKilledTargetType)
                    {
                        Destroy(target.gameObject);
                    }
                    else
                    {
                        time = 2f;
                        target.playAnimation();
                    }
                    currentTarget        = target.gameObject;
                    playerScores        += getPointsFromTarget(target.getType());
                    lastKilledTargetType = target.getType();
                    Debug.Log("Score: " + playerScores);
                }
            }
        }