Beispiel #1
0
    public void StartGame()
    {
        gameIsOn = true;

        if (_gridGenerator != null)
        {
            _gridGenerator._useAutoGeneration = false;
            _gridGenerator.SetGridLevel(_gridGenerator.GetComponent <GridLevel>());
            _gridGenerator.Generate();
        }
        if (_requestManager != null)
        {
            _requestManager._gameManager = this;
            _requestManager._gridLevel   = _gridGenerator.GetComponent <GridLevel>();
            _requestManager.InitializeRequestItems();
            _requestManager.SetRequestCount(3);
        }
        if (_scoreDisplay != null)
        {
            _score = 0;
            _scoreDisplay.SetScore(_score);
            _scoreDisplay.gameObject.SetActive(true);
        }

        timer = gameTime;
    }
Beispiel #2
0
    /// <summary>
    /// Only call with null go if it's the laser shooting
    /// </summary>
    /// <param name="thingShot"></param>
    public void Hit(GameObject thingShot = null)
    {
        if (thingShot == null)
        {
            if (typeOfHit == TypeOfHit.ShieldHit)
            {
                //if (scoreDisplay) scoreDisplay.AddScore(thisScore);

                Score += thisScore;
                scoreDisplay.SetScore(Score);
            }
        }
        else if (thingShot.TryGetComponent(out ShotThing st))
        {
            if (st.whoSent == ShotThing.shotFrom.Player && typeOfHit == TypeOfHit.ShieldHit)
            {
                //if (scoreDisplay)
                //scoreDisplay.AddScore(thisScore);

                Score += thisScore;
                scoreDisplay.SetScore(Score);
            }
        }
    }
Beispiel #3
0
 public void ScorePoints()
 {
     score        += comboCount;
     moneyEvery10 += comboCount;
     if (moneyEvery10 / 10 >= 1)
     {
         GameManager.instance.AddMoney();
         moneyEvery10 = score % 10;
     }
     comboCount++;
     if (comboCount >= 5)
     {
         comboCount = 5;
         superBall  = true;
     }
     scrDis.SetScore(score);
     ChangeTime();
 }
Beispiel #4
0
    private void FixedUpdate()
    {
        if (timer <= timerGoal)
        {
            timer += Time.fixedDeltaTime;
        }

        if (s_scoreDisplay != null)
        {
            s_scoreDisplay.SetScore(CurrentMoney, m_moneyChangeLastFrame);
            m_moneyChangeLastFrame = currentMoney;
        }

        if (timer >= timerGoal)
        {
            DeductSalary();
        }

        if (float.IsNaN(GeneratedMoney + DeductedMoney))
        {
            return;
        }
        CurrentMoney += GeneratedMoney + DeductedMoney;
        moneyDifferenceLastGenerate = GeneratedMoney + DeductedMoney;
        GeneratedMoney = 0;
        DeductedMoney  = 0;

        //Counts how many npcs are working
        foreach (var npc in DAS.NPC.s_npcList)
        {
            if (npc.moveRef.IsCurrentlyWorking)
            {
                fakeMoneyGen    += (DAS.NPC.s_motivationAverage + npc.myFeelings.Motivation) / 2;
                highscorePoints += (DAS.NPC.s_motivationAverage + npc.myFeelings.Motivation) / 2;
            }
        }

        fakeMoneyGen += 1f / 2;

        potentialMoneyDifference = fakeMoneyGen + fakeMoneyDed;

        fakeMoneyGen = 0;
        fakeMoneyDed = 0;
    }
Beispiel #5
0
    private void Start()
    {
        m_highscoreListScreen = HighscoreListScreen.s_thisInstance;
        moneyLost             = 0;
        highscorePoints       = 0;
        m_startMoney          = 40000;
        currentMoney          = m_startMoney;
        CurrentMoney          = m_startMoney;
        run = false;

        GeneratedMoney = 0;
        DeductedMoney  = 0;

        s_scoreDisplay = FindObjectOfType <ScoreDisplay>();
        if (s_scoreDisplay != null)
        {
            s_scoreDisplay.SetScore(CurrentMoney, m_moneyChangeLastFrame);
        }
    }
Beispiel #6
0
    void Update()
    {
        Vector2 dir = GetDirection();

        Move(dir, speed);

        health_display.SetHealth(health);
        energy_display.SetEnergy(energy);
        score_display.SetScore(score);

        if (health <= 0)
        {
            GameOver();
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            TryFire();
        }
    }
Beispiel #7
0
 public void AddToScore(int points)
 {
     score += points;
     scoreDisplay.SetScore(score.ToString());
 }