Пример #1
0
        public void ShipTakeDamage(int damage, int expected)
        {
            // Use the Assert class to test conditions
            ShipHealth ship = new ShipHealth(10);

            ship.TakeDamage(damage);

            Assert.That(ship.GetHealth(), Is.EqualTo(expected));
        }
Пример #2
0
    void Update()
    {
        bool blocked = false;

        if (!gameOver)
        {
            blocked = progressEvents[currentEventIndex].method();
        }
        else
        {
            blocked = EventDeath();
        }
        canGoToNextEvent |= blocked;

        if (!progressPaused)
        {
            progressValue += progressPercentagePerSecond / 100f * Time.deltaTime;
        }
        if (progressValue > 1.01f)
        {
            progressValue = 1.01f;
        }

        if (currentEventIndex < progressEvents.Count - 1 && (canGoToNextEvent || progressEvents[currentEventIndex + 1].priority) && progressValue >= progressEvents[currentEventIndex + 1].progressNeeded)
        {
            firstRunOfEvent = true;
            currentEventIndex++;
            canGoToNextEvent = false;
        }

        if (!gameOver && (shipHealth.GetHealth() <= 0 || droneMinigame.oxygenAmount < 0.001f))
        {
            gameOver        = true;
            firstRunOfEvent = true;
        }

        float newY = Mathf.Lerp(bgInitialY, bgInitialY + amountToScrollBG, progressValue);
        float newYProgressIndicator = Mathf.Lerp(progressIndicatorInitialY, progressIndicatorInitialY - amountToScrollIndicator, progressValue);

        exteriorBackground.transform.position = new Vector2(exteriorBackground.transform.position.x, newY);
        progressIndicator.transform.position  = new Vector2(progressIndicator.transform.position.x, newYProgressIndicator);
    }