예제 #1
0
    protected void TryCaptureOrRecharge(Portal portal, AchievementModel achievement)
    {
        if (portal.Model.Faction == Faction.None)
        {
            GameProvider.CapturePortal(portal, SelfFaction);

            achievement.Capture(portal.Model);
            if (ShouldSound)
            {
                SoundManager.GetInstance().PortalCapturedSound.Play();
            }
        }
        else if (portal.Model.Faction == SelfFaction)
        {
            if (portal.Energy < 100 && rechargeTimer.IsTimeout())
            {
                portal.RechargeEnergy(10);
                rechargeTimer.Start();

                achievement.Recharge();
                if (ShouldSound)
                {
                    SoundManager.GetInstance().PortalRechargedSound.Play();
                }
            }
        }
    }
예제 #2
0
 // Update is called once per frame
 void Update()
 {
     if (!IsActive)
     {
         if (Input.touchCount > 0 || Input.GetMouseButton(0))
         {
             if (!activationTimerCounting)
             {
                 activationTimer.Start();
                 activationTimerCounting = true;
             }
             else
             {
                 if (activationTimer.IsTimeout())
                 {
                     InputPad.SetActive(true);
                     activationTimerCounting = false;
                     SoundManager.GetInstance().MenuSelectSound.Play();
                 }
             }
         }
         else
         {
             activationTimerCounting = false;
         }
     }
 }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        // Transitive state
        switch (currentStep)
        {
        case 2:
            gameStartWaitTimer        = new TimeTicker(2).Start();                                               // start timer
            Mask.transform.localScale = new Vector3(0.5f, 0.5f, 1);                                              // init mask size
            StartCoroutine(SoundManager.GetInstance().StartUpVoices[0].PlayWithDelay(0.7f, 1.5f));               // voice #1 after 0.7 secs
            StartCoroutine(SoundManager.GetInstance().StartUpVoices[Random.Range(1, 4)].PlayWithDelay(2, 1.5f)); // voice #2 after 2 secs
            currentStep++;
            return;                                                                                              // do not proceed

        case 3:
            Mask.transform.localScale *= (1 + Time.deltaTime * 5);     // scale up the mask
            if (gameStartWaitTimer.IsTimeout())
            {
                StartGame();
            }
            return;     // do not proceed
        }

        // Interactive state
        var  input        = GetInput();
        bool valueChanged = false;

        switch (currentStep)
        {
        case 0:
            int newFaction = Mathf.Clamp(Faction - input, 0, 1);
            valueChanged = Faction != newFaction;
            Faction      = newFaction;
            break;

        case 1:
            int newLevel = Mathf.Clamp(Level - input, 0, 2);
            valueChanged = Level != newLevel;
            Level        = newLevel;
            break;
        }

        if (valueChanged)
        {
            SoundManager.GetInstance().MenuMoveSound.Play();
        }

        UpdateArrow();

        if (InputUtil.GetButtonDown(0))
        {
            SoundManager.GetInstance().MenuSelectSound.Play();
            currentStep++;
        }

        if (InputUtil.GetButtonDown(1) && currentStep > 0)
        {
            currentStep--;
        }
    }
예제 #4
0
 private void WaitForButtonAndGoBackToMenu()
 {
     if (gameOverScreenWaitTimer.IsTimeout() &&
         (InputUtil.GetButtonDown(0) || InputUtil.GetButtonDown(1)))
     {
         SceneManager.LoadScene(GameConstants.MenuScene);
     }
 }
예제 #5
0
 // Update is called once per frame
 void Update()
 {
     if (flashTimer != null && flashTimer.IsTimeout())
     {
         TextComponent.color = NormalColor;
         flashTimer          = null;
     }
 }
예제 #6
0
    // TODO Player specific?
    public bool TryHack(Faction faction, ItemInventoryModel inventory)
    {
        if (!coolDownTimer.IsTimeout())
        {
            return(false);
        }

        coolDownTimer.Start();

        inventory.AddBursters(Mathf.FloorToInt(Random.value * BursterDropRate));

        if (Random.value < KeyDropRate)
        {
            inventory.AddKey(Model);
        }

        return(true);
    }
예제 #7
0
    private int GetInput()
    {
        var input = InputUtil.GetY();

        if (input != 0)
        {
            if (keyInputRepeatTimer.IsTimeout())
            {
                keyInputRepeatTimer.Start();
                return(input);
            }
            else
            {
                return(0);
            }
        }
        else
        {
            keyInputRepeatTimer.Reset();
            return(input);
        }
    }
예제 #8
0
 // Update is called once per frame
 void Update()
 {
     HackIndicatorText.Text = hackIndicatorTimer.IsTimeout() ? "BURSTER" : "HACK";
 }