Beispiel #1
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        FervorBucket bucket = coll.gameObject.GetComponent <FervorBucket>();

        if (bucket.IsConverted())
        {
            _fervor++;
        }
        else
        {
            _fervor--;
        }

        _fervor = Mathf.Clamp(_fervor, 0.0f, c_maxFervor);

        _progressBar.SetValue(_fervor, c_maxFervor);

        if (_fervor < 50)
        {
            _isConverted = false;
        }
        else
        {
            _isConverted = true;
        }
    }
Beispiel #2
0
    void InstantiateBar(int num)
    {
        if (num < 0 || num >= progressBarPrefabs.Length)
        {
            return;
        }

        currentPrefab = num;

        if (bar != null)
        {
            Destroy(bar.gameObject);
        }

#if UNITY_5_2 || UNITY_5_3 || UNITY_5_4_OR_NEWER
        bar = Instantiate <ProgressBarPro>(progressBarPrefabs[num], prefabParent);
#else
        bar = Instantiate(progressBarPrefabs[num]) as ProgressBarPro;
        bar.transform.SetParent(prefabParent);
#endif
        bar.gameObject.SetActive(false);
        bar.transform.localScale = Vector3.one;
        bar.SetValue(currentValue);
        bar.gameObject.SetActive(true);

        prefabName.text = progressBarPrefabs[currentPrefab].gameObject.name;

        Invoke("EnableBar", 0.01f);
    }
    // Update is called once per frame
    void Update()
    {
        if (worker.humanPlayer)
        {
            nameToDisplay.text = worker.playerName;
        }

        abilityUI.SetValue(worker.abilityUses, 3);
    }
Beispiel #4
0
    public void SetValue(float value)
    {
        currentValue = value;

        if (bar != null)
        {
            bar.SetValue(value);
        }
    }
Beispiel #5
0
    // Update is called once per frame
    void Update()
    {
        buildProgress = worker.taskProgress;
        barricadeXP   = buildProgress - (float)offset;

        barricadeXPUI.SetValue(barricadeXP, 25f);

        if (buildProgress >= 25 && buildProgress < 50 && barricadeLevel == 0)
        {
            barricadeLevel = 1;
            board[0].SetActive(true);
            offset = 25;
            barricadeStatus.text = "UPGRADING BARRICADE";
            levelNumber.text     = "1";
        }
        else if (buildProgress >= 50 && buildProgress < 75 && barricadeLevel == 1)
        {
            barricadeLevel = 2;
            board[1].SetActive(true);
            offset = 50;
            barricadeStatus.text = "UPGRADING BARRICADE";
            levelNumber.text     = "2";
        }
        else if (buildProgress >= 75 && buildProgress < 100 && barricadeLevel == 2)
        {
            barricadeLevel = 3;
            board[2].SetActive(true);
            offset = 75;
            barricadeStatus.text = "UPGRADING BARRICADE";
            levelNumber.text     = "3";
        }
        else if (buildProgress >= 100 && barricadeLevel == 3)
        {
            barricadeLevel = 4;
            board[3].SetActive(true);
            barricadeStatus.text = "";
            levelNumber.text     = "MAX";
            worker.playerStatus  = HorrorCharacterController.Status.idle;
        }
    }
Beispiel #6
0
 public void IncreaseMojo()
 {
     pointParticles.Play();
     totalPercent += percentagePerPoint;
     if (totalPercent <= 1f)
     {
         progressBar.SetValue(totalPercent);
     }
     if (totalPercent >= 1f)
     {
         GetComponent <Animator>().Play("Play");
         finaleParticles.Play();
     }
 }
Beispiel #7
0
    // Update is called once per frame
    void Update()
    {
        overallProgress = worker.taskProgress;
        readingProgress = overallProgress - (float)offset;

        spellProgressUI.SetValue(readingProgress, 50f);

        if (overallProgress >= 50 && overallProgress < 100 && spellLevel == 0)
        {
            spellLevel = 1;

            offset             = 50;
            spellLevelTxt.text = "CASTING BANISH SPELL";
        }
    }
Beispiel #8
0
    // Update is called once per frame
    void Update()
    {
        overallProgress = worker.taskProgress;
        phoneProgress   = overallProgress - (float)offset;

        phoneProgressUI.SetValue(phoneProgress, maxValue);

        if (overallProgress >= 60 && overallProgress < 100 && phoneLevel == 0)
        {
            phoneLevel = 1;

            offset             = 60;
            maxValue           = 40;
            phoneLevelTxt.text = "CALLING 911";
        }
    }
Beispiel #9
0
    internal virtual void TakeHit()
    {
        health -= 10.0f;
        healthBar.SetValue(health / MaxHealth);

        if (health <= 0)
        {
            if (pullable != null)
            {
                lock (pullable)
                {
                    NexusPull.instance.RemovePullableObject(pullable);
                }
            }

            Destroy(this.gameObject);
        }
    }
Beispiel #10
0
    internal virtual void TakeHit(float damageToTake = 10.0f)
    {
        if (IsInvulnerable())
        {
            return;
        }

        health -= damageToTake;
        healthBar.SetValue(GetHealthRatio());

        if (health <= 0)
        {
            if (pullable != null)
            {
                lock (pullable)
                {
                    NexusPull.instance.RemovePullableObject(pullable);
                }
            }

            OnKilled();
            Destroy(this.gameObject);
        }
    }
 private void UpdateHealthBar()
 {
     healthBar.SetValue(health, maxHealth);
 }
 // Use this for initialization
 void Start()
 {
     p_harvestExplosions = Resources.LoadAll <GameObject>("Explosions");
     _progressBar.SetValue(_fervor, c_maxFervor);
     StartCoroutine(AddFervor());
 }
    // Use this for initialization
    void Start()
    {
        _healthBar.SetValue(_fervor, c_maxFervor);

        SetColor();
    }
Beispiel #14
0
    // Update is called once per frame
    void Update()
    {
        overallProgress = mechanic.taskProgress;
        carProgress     = overallProgress - (float)offset;

        carProgressUI.SetValue(carProgress, maxValue);

        if (overallProgress >= 15 && overallProgress < 50 && carLevel == 0)
        {
            carLevel = 1;
            offset   = 15;
            maxValue = 85;

            blackSmoke.SetActive(true);
            whiteSmoke.SetActive(false);

            car[0].SetActive(false);
            car[1].SetActive(true);
            car[2].SetActive(false);
            car[3].SetActive(false);
            car[4].SetActive(false);
        }
        else if (overallProgress >= 50 && overallProgress < 75 && carLevel == 1)
        {
            carLevel = 2;

            blackSmoke.SetActive(true);
            whiteSmoke.SetActive(false);

            car[0].SetActive(false);
            car[1].SetActive(false);
            car[2].SetActive(true);
            car[3].SetActive(false);
            car[4].SetActive(false);
        }
        else if (overallProgress >= 75 && overallProgress < 100 && carLevel == 2)
        {
            carLevel = 3;
            blackSmoke.SetActive(false);
            whiteSmoke.SetActive(true);

            car[0].SetActive(false);
            car[1].SetActive(false);
            car[2].SetActive(false);
            car[3].SetActive(true);
            car[4].SetActive(false);
        }
        else if (overallProgress >= 100 && carLevel == 3)
        {
            carLevel = 4;

            blackSmoke.SetActive(false);
            whiteSmoke.SetActive(false);

            car[0].SetActive(false);
            car[1].SetActive(false);
            car[2].SetActive(false);
            car[3].SetActive(false);
            car[4].SetActive(true);
        }
    }
Beispiel #15
0
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Keypad1) && canRoll)
        {
            if (rList.Count > 0)
            {
                rollTimer = 0;
                rollTimerPBP.SetValue(rollTimer, 100);
                rollForButton = Random.Range(1, 6);
                while (!rList.Contains(rollForButton))
                {
                    rollForButton = Random.Range(1, 6);
                }

                RollForButton(rollForButton);
                canRoll = false;
            }
        }

        if (Input.GetKeyUp(KeyCode.Keypad2) && canLock)
        {
            if (rList.Count > 0)
            {
                lockTimer = 0;
                lockTimerPBP.SetValue(lockTimer, 800);

                StartCoroutine(WaitForKeyDown(KeyCode.W));
                StartCoroutine(WaitForKeyDown(KeyCode.A));
                StartCoroutine(WaitForKeyDown(KeyCode.S));
                StartCoroutine(WaitForKeyDown(KeyCode.D));
                StartCoroutine(WaitForKeyDown(KeyCode.Space));
                canLock = false;
            }
        }
        //main timer for reset
        if (mainTimer >= 1)
        {
            mainTimer--;
            mainTimerPBP.SetValue(mainTimer, 4000);
        }
        else if (mainTimer <= 0)
        {
            mainTimer = 4000;
            ResetSchematic();
        }
        //roll timer
        if (canRoll == false)
        {
            if (rollTimer < 100)
            {
                rollTimer++;
                rollTimerPBP.SetValue(rollTimer, 100);
            }
            else
            {
                canRoll = true;
            }
        }
        //lock timer
        if (canLock == false)
        {
            if (lockTimer < 800)
            {
                lockTimer++;
                lockTimerPBP.SetValue(lockTimer, 800);
            }
            else
            {
                canLock = true;
            }
        }
    }