Example #1
0
    private void Update()
    {
        AllRelicsObtained();
        //This switch state is pure pile of garbage
        //If you have a better solution for not destroying the relic and just turn off the light without the counter going crazy pls fix 🙏
        switch (state)
        {
        case relicState.unscanned:
            print("unscanned");
            break;

        case relicState.beingScanned:
            print("being scanned");
            break;

        case relicState.incompleteScan:
            resetTime();
            print("incomplete");
            state = relicState.unscanned;
            break;

        case relicState.completeScan:
            isComplete = true;
            //Destroy(gameObject);
            print("complete");
            light.SetActive(false);
            //relicCounter.AddRelicCounterValue();
            relicCounter.counterValue++;
            break;
        }

        if (state != relicState.completeScan && !isComplete)
        {
            if (currentScanTime == 0 && !isComplete)
            {
                state = relicState.completeScan;
            }
            else if (!isComplete && currentScanTime > 0 && Input.GetKeyDown("f"))
            {
                print("epic gamer moment");
                state = relicState.beingScanned;
            }
            else if (currentScanTime > 0 && Input.GetKeyUp("f"))
            {
                state = relicState.incompleteScan;
            }
            else
            {
                //state = relicState.unscanned;
            }
        }
    }
Example #2
0
 public void ScanTickDown(float TickDownAmount)
 {
     state = relicState.beingScanned;
     if (currentScanTime > 0)
     {
         currentScanTime -= TickDownAmount;
     }
     else
     {
         //Thx Jax ❤
         Destroy(gameObject);
         relicCounter.counterValue++;
     }
     currentScanTime = Mathf.Clamp(currentScanTime, 0, scanTime);
 }