Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        trackable      = trackableHandler.getTrackableBehaviour();
        trackingStatus = trackable.CurrentStatus;

        if (trackingStatus == TrackableBehaviour.Status.TRACKED)
        {
            if (Input.GetMouseButtonDown(0))
            {
                Debug.Log("Button pressed");

                StartCoroutine(mouseShooting());
            }
            else if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
            {
                Debug.Log("Screen touched");

                StartCoroutine(touchShooting());
            }
        }


        if (spiderCount < numberSpiders && trackingStatus == TrackableBehaviour.Status.TRACKED)
        {
            StartCoroutine(generateSpiders());
        }
        else if (spiderCount > 0 && trackingStatus != TrackableBehaviour.Status.TRACKED)
        {
            //Debug.Log("Killing spiders");
            StartCoroutine(destroySpiders());
        }

        float health = deathScript.GetPlayerHealth();

        if (health > 0)
        {
            playerHealth.text = "Health: " + health + "%";
        }
        else
        {
            StartCoroutine(PlayerDead());
        }
    }