Exemplo n.º 1
0
    /// <summary>
    /// Called when a computer randomly crashes
    /// </summary>
    private void crashComputer()
    {
        // Only allow waiting to crash computers to crash
        if (_state == ComputerState.WaitingToCrash || _state == ComputerState.RaptorCrashingComputer)
        {
            SetComputerColour(_state == ComputerState.WaitingToCrash ? Color.magenta : Color.yellow);
            _state = ComputerState.Crashed;

            if (linkedDoor != null)
            {
                linkedDoor.ReleaseTheRaptor();
            }

            _crashTimer  = CM.TimeFromCrashToExplode;
            _timerLength = _crashTimer;
            pBar.gameObject.SetActive(true);
            // Release the raptor (if it hasn't already been released and there is one associated with this computer
            if (currentRaptorUser != null)
            {
                currentRaptorUser.FindNewTarget();
                currentRaptorUser._rState = RaptorAI.RaptorState.HeadingToTarget;
                currentRaptorUser         = null;
            }
        }
    }
Exemplo n.º 2
0
 private void OnTriggerEnter(Collider other)
 {
     // If we've already clicked on the computer before being in range
     if (other.gameObject.layer == LayerMask.NameToLayer("Player"))
     {
         if (other.gameObject.GetComponent <PlayerControl> ().targettedComputer == computerID)
         {
             if (_state == ComputerState.Crashed)
             {
                 other.gameObject.GetComponent <PlayerControl> ().ShowComputerTools();
             }
         }
     }
     else if (other.gameObject.layer == LayerMask.NameToLayer("Raptor"))
     {
         RaptorAI tmpRaptor = other.gameObject.GetComponent <RaptorAI> ();
         if (tmpRaptor.targettedComputer == this)
         {
             if (tmpRaptor._rState == RaptorAI.RaptorState.Content && _state != ComputerState.Exploding)
             {
                 // Take permanent control of this computer. But not if computer has already exploded and we're in the few seconds wait for the game to end
                 if (currentRaptorUser != null)
                 {
                     // There's another raptor at this computer already??
                     // Chase it away
                     RaptorInterferenceInterferedWith();
                 }
                 // Set up this computer to be happy forever
                 TrainedRaptorAtComputer();
             }
             else
             {
                 if (_state == ComputerState.WaitingToCrash)
                 {
                     RaptorVisitsComputer(tmpRaptor);
                 }
                 else
                 {
                     // Computer crashed before the raptor could crash it, but after it targetted it
                     tmpRaptor.FindNewTarget();
                 }
             }
         }
     }
 }