Пример #1
0
 void Update()
 {
     if (playerInTrigger)
     {
         PlayerMessage.Add(warning);
     }
 }
Пример #2
0
 void UpdateFolding(Transform t)
 {
     if (t != null)
     {
         Box b = t.GetComponent <Box>();
         if (b != null && !b.isFolded)
         {
             if (Input.GetKey(KeyCode.F))
             {
                 float adjustedFloatTime = foldTime * b.transform.localScale.x;
                 if (foldProgress > adjustedFloatTime && !GameManager.isPaused)
                 {
                     b.Fold();
                     foldProgress = 0;
                 }
                 else
                 {
                     PlayerMessage.Add($"Folding box... <color={Colors.PROGRESS}>{(foldProgress/adjustedFloatTime) * 100:0}%</color>");
                     foldProgress += Time.deltaTime;
                 }
             }
             else
             {
                 PlayerMessage.Add(foldBoxMessage);
             }
         }
     }
 }
Пример #3
0
    void Update()
    {
        if (GameManager.gameOver)
        {
            groundTouching = null;
            return;
        }

        if (groundTouching != null)
        {
            timeLittered += Time.deltaTime;
            if (timeLittered < timeToCallCopsForLittering)
            {
                float timeLeft = timeToCallCopsForLittering - timeLittered;
                PlayerMessage.Add($"You can\'t leave your boxes on the ground outside, that\'s littering. Your neighbors will call the cops in <color={(((int)(timeLeft * 2)) % 2 == 0 ? Colors.WEE : Colors.WOO)}>{timeLeft:0.00}s</color>.");
            }
            else
            {
                if (!GameManager.gameOver)
                {
                    GameManager.GameOver(GameOverReasons.LITTERING);
                }
            }
        }
    }
Пример #4
0
    void WhatsInTheBox(Transform t)
    {
        Box box = t.GetComponent <Box>();

        if (box != null)
        {
            PlayerMessage.Add($"<color={Colors.ITEM_NAMES}>{box.contents}</color>");

            if (t == grabbedItem)
            {
                PlayerMessage.Add(dropBoxMessage);
            }
            else if (t == lookingAt)
            {
                PlayerMessage.Add(pickUpBoxMessage);
            }
        }
    }
Пример #5
0
    void Update()
    {
                #if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.M))
        {
            ToggleMouse();
        }
        if (Input.GetKeyDown(KeyCode.O))
        {
            ScreenCapture.CaptureScreenshot($"screenshot-{System.DateTime.Now.ToLongTimeString()}.png");
        }
                #endif

        if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.P))
        {
            TogglePause();
        }

        if (Input.GetKeyDown(KeyCode.F3))
        {
            ToggleDebugMenu();
        }

        CalculateFPS();
        CheckBoxVolume();

                #if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.R))
        {
                #else
        if (gameOver && Input.GetKeyDown(KeyCode.R))
        {
                #endif
            Reset();
        }

        if (score > 0)
        {
            PlayerMessage.Add($"Score: {score} (Best: {highScore})");
        }
        else
        {
            PlayerMessage.Add(whatToDoMessage);
        }

        if (gameOver)
        {
            DebugInfo.Add($"gameOver: {gameOver} ({gameOverReason})");
        }
        else
        {
            DebugInfo.Add($"gameOver: {gameOver}");
        }

        if (gameOver)
        {
            switch (gameOverReason)
            {
            case GameOverReasons.TOO_MANY_BOXES:
                PlayerMessage.Add(gameOverMessage);
                break;

            case GameOverReasons.LITTERING:
                PlayerMessage.Add(gameOverMessageLittering);
                break;

            default:
                PlayerMessage.Add(gameOverMessageUnknown);
                break;
            }
            return;
        }
    }
}
Пример #6
0
    void Update()
    {
        if (GameManager.gameOver)
        {
            return;
        }

        if (candidate != null)
        {
            if (candidate.isHeld)
            {
                candidate = null;
            }
            else if (boxes.Count >= maxCapacity)
            {
                PlayerMessage.Add(atMaxCapacity);
            }
            else if (!candidate.isFolded)
            {
                PlayerMessage.Add(notFolded);
            }
            else
            {
                GameManager.player.LetGo();

                Collider col = candidate.GetComponent <Collider>();
                if (col != null)
                {
                    Destroy(col);
                }

                Rigidbody rb = candidate.GetComponent <Rigidbody>();
                if (rb != null)
                {
                    Destroy(rb);
                }

                candidate.transform.SetParent(boxSpots[boxes.Count]);
                candidate.transform.localPosition = Vector3.zero;
                candidate.transform.localRotation = Quaternion.identity;
                candidate.transform.localScale    = Vector3.one * 0.48f;

                boxes.Add(candidate);

                candidate = null;
            }
        }

        int count = boxes.Count;

        if (count > 0)
        {
            PlayerMessage.Add($"Recycling space left: <color={Colors.THINGS_REMAINING}>{maxCapacity - count}</color> / Time until next collection: <color={Colors.THINGS_REMAINING}>{timeUntilEmpty:0.00}s</color>");
        }

        timeUntilEmpty -= Time.deltaTime;
        if (timeUntilEmpty < 0)
        {
            Empty();
            timeUntilEmpty = timeToEmpty;
        }
    }