public override void Update()
    {
        if (!_activationStarted)
        {
            if (Random.Range(1, 100) <= DifficultLevel.PercentChanceForActivatingNextMachine() && Random.Range(1, 100) > 75)
            {
                ActiveMachines.AddActiveMachine();
                _activationStarted = true;
                float activationTime = Random.Range(machine.activationInterval / 3, machine.activationInterval);
                Invoke("ActivateMachine", activationTime);
            }
        }


        if (!_helmMinigameReadyToStart && !_helmMinigameStarted && _periscopeInteractable.GetState() == InteractableState.Blocked && GetState() == InteractableState.Blocked)
        {
            _helmMinigameReadyToStart = true;
        }

        if (_helmMinigameReadyToStart && !_helmMinigameStarted)
        {
            _helmMinigameStarted = true;
            RunMinigame();
        }
    }
Esempio n. 2
0
 public virtual void Update()
 {
     if (!_activationStarted)
     {
         if (Random.Range(1, 100) <= DifficultLevel.PercentChanceForActivatingNextMachine() && Random.Range(1, 100) > 75)
         {
             ActiveMachines.AddActiveMachine();
             _activationStarted = true;
             float activationTime = Random.Range(machine.activationInterval / 3, machine.activationInterval);
             Invoke("ActivateMachine", activationTime);
         }
     }
 }
Esempio n. 3
0
    public virtual void DeactivateMachine()
    {
        if (machine.gameType != GameType.TEA && machine.gameType != GameType.PERISCOPE)
        {
            ActiveMachines.RemoveActiveMachine();
        }

        _alarmController.TurnOff();
        _state = InteractableState.Deactivated;

        foreach (var playerController in _playerControllers)
        {
            playerController.SetPlayerStatus(PlayerStatus.Free);
        }

        _playerControllers.Clear();
        Invoke("ClearActivationStarted", Random.Range(0f, 5f));
    }
    public override void DeactivateMachine()
    {
        ActiveMachines.RemoveActiveMachine();

        _alarmController.TurnOff();
        _activationStarted    = false;
        _state                = InteractableState.Deactivated;
        _spriteRenderer.color = Color.white;
        _periscopeInteractable.DeactivateMachine();

        _helmMinigameStarted      = false;
        _helmMinigameReadyToStart = false;

        foreach (var playerController in _playerControllers)
        {
            playerController.SetPlayerStatus(PlayerStatus.Free);
        }

        _playerControllers.Clear();

        Debug.Log("Deactivated helm");
        Invoke("ClearActivationStarted", Random.Range(0f, 5f));
    }
Esempio n. 5
0
    public static int PercentChanceForActivatingNextMachine()
    {
        int activeMachineQuantity = ActiveMachines.GetActiveMachinesQuantity();

        switch (GetDifficultLevel())
        {
        case 1:
            if (activeMachineQuantity == 0)
            {
                return(100);
            }
            return(0);

        case 2:
            if (activeMachineQuantity == 0)
            {
                return(100);
            }
            if (activeMachineQuantity == 1)
            {
                return(20);
            }
            return(0);

        case 3:
            if (activeMachineQuantity == 0)
            {
                return(100);
            }
            if (activeMachineQuantity == 1)
            {
                return(40);
            }
            return(0);

        case 4:
            if (activeMachineQuantity == 0)
            {
                return(100);
            }
            if (activeMachineQuantity == 1)
            {
                return(60);
            }
            return(0);

        case 5:
            if (activeMachineQuantity == 0)
            {
                return(100);
            }
            if (activeMachineQuantity == 1)
            {
                return(80);
            }
            return(0);

        case 6:
            if (activeMachineQuantity == 0)
            {
                return(100);
            }
            if (activeMachineQuantity == 1)
            {
                return(100);
            }
            if (activeMachineQuantity == 2)
            {
                return(20);
            }
            return(0);

        case 7:
            if (activeMachineQuantity == 0)
            {
                return(100);
            }
            if (activeMachineQuantity == 1)
            {
                return(100);
            }
            if (activeMachineQuantity == 2)
            {
                return(20);
            }
            return(0);

        case 8:
            if (activeMachineQuantity == 0)
            {
                return(100);
            }
            if (activeMachineQuantity == 1)
            {
                return(100);
            }
            if (activeMachineQuantity == 2)
            {
                return(60);
            }
            return(0);

        case 9:
            if (activeMachineQuantity == 0)
            {
                return(100);
            }
            if (activeMachineQuantity == 1)
            {
                return(100);
            }
            if (activeMachineQuantity == 2)
            {
                return(80);
            }
            return(0);

        default:
            if (activeMachineQuantity == 0)
            {
                return(100);
            }
            if (activeMachineQuantity == 1)
            {
                return(100);
            }
            if (activeMachineQuantity == 2)
            {
                return(100);
            }
            return(0);
        }
    }