Ejemplo n.º 1
0
    //turn on the scan
    void ScanOn()
    {
        scanningObject = select.selectedObject;
        scan           = scanningObject.GetComponent <ObjectScannable>();
        if (scan == null)
        {
            return;
        }
        //if it's a door, check if we scanned it before and after neutralisation
        ObjectDoor door = scanningObject.GetComponent <ObjectDoor>();

        if (door != null)
        {
            if (door.isScannedOnce == false)
            {
                door.isScannedOnce = true;
            }
            else if (scan.number == 0)
            {
                door.isScannedAfterNeutralise = true;
            }
        }
        isScanning = true;
        //get the scanning readout on the scanner screen
        UpdateUIText(scan.number.ToString());
        //start a coroutine that keeps the scan readout up on the screen for readingsTimer seconds
        timerCoroutine = StartCoroutine(CountDown(readingsTimer));

        //if we have audio components, play the scanning sound
        if (scanSound != null && audios != null)
        {
            audios.clip = scanSound;
            audios.Play();
        }
    }
Ejemplo n.º 2
0
 //what happens when we turn off the scan
 void ScanOff()
 {
     isScanning     = false;
     scanningObject = null;
     scan           = null;
     UpdateUIText("");
     if (timerCoroutine != null)
     {
         StopCoroutine(timerCoroutine);
         timerCoroutine = null;
     }
 }
Ejemplo n.º 3
0
    public void Shoot()
    {
        //if we cannot find some of the needed scripts, we return
        if (ring == null || select == null || scan == null || select.selectedObject == null)
        {
            return;
        }

        ObjectScannable objectScan = select.selectedObject.GetComponent <ObjectScannable>();

        if (objectScan == null)
        {
            return;
        }

        ObjectShootable objectShoot = select.selectedObject.GetComponent <ObjectShootable>();

        if (objectShoot == null)
        {
            return;
        }
        //we call the objects Shoot function (so it can count in the score summary)
        objectShoot.Shoot(ring.CurrRing);

        //if we shot with the correct ring rotation, we neutralise the object
        if (ring.CurrRing == objectScan.number)
        {
            objectScan.number = 0;
        }
        //we turn off the scanning window if it's still up, so we have to scan again to make sure the object is neutralised
        scan.TurnOff();

        //if we have the audio components, play the shooting sound
        if (shootSound != null && audios != null)
        {
            audios.clip = shootSound;
            audios.Play();
        }
    }