Exemple #1
0
    public void Apply(IslandResources resources)
    {
        resources.Wood     += WoodDelta;
        resources.Minerals += MineralsDelta;
        resources.Water    += WaterDelta;
        resources.Worship  += WorshipDelta;

        if (resources.Wood < 0)
        {
            resources.Wood = 0;
        }

        if (resources.Minerals < 0)
        {
            resources.Minerals = 0;
        }

        if (resources.Water < 0)
        {
            resources.Water = 0;
        }

        if (resources.Worship < 0)
        {
            resources.Worship = 0;
        }
    }
Exemple #2
0
    internal void ApplyDeltas(IslandResources resources)
    {
        foreach (var card in pool)
        {
            if (!card.IsFaceUp)
            {
                continue;
            }

            card.Details.Apply(resources);
        }

        resources.Generation++;
    }
    void Awake()
    {
        _resources     = new IslandResources();
        _lifeformDeck  = GetComponent <LifeformDeck>();
        _planetDeck    = GetComponent <PlanetDeck>();
        audioSource    = GetComponent <MusicBehaviour>();
        highestWorship = _resources.Worship;

        _lifeformDeck.CardClicked += LifeformDeck_CardClicked;
        _planetDeck.CardClicked   += PlanetDeck_CardClicked;

        endTurn.onClick.AddListener(new UnityAction(() => {
            _state = GameState.RoundOver;
        }));

        gameOver.onClick.AddListener(new UnityAction(() => {
            SceneManager.LoadScene("main");
        }));

        musicPlaying = PlayerPrefs.GetInt("music", 1) == 1;
        if (musicPlaying)
        {
            musicLabel.text = "Music On";
        }
        else
        {
            musicLabel.text = "Music Off";
        }

        var musicController = GetComponent <MusicBehaviour>();

        musicButton.onClick.AddListener(new UnityAction(() => {
            musicPlaying = !musicPlaying;
            if (musicPlaying)
            {
                musicLabel.text = "Music On";
            }
            else
            {
                musicLabel.text = "Music Off";
            }
            musicController.ToggleMusic(musicPlaying);
        }));
    }