Beispiel #1
0
    protected void OnHeadlineResolved(IdealType idealType, IdealLean lean)
    {
        List <Sheep> flippingSheep = new List <Sheep>();

        // Get sheep's whose lean are opposite to the headline idealType.
        for (int i = 0; i < allSheep.Count; i++)
        {
            Sheep     sheep     = allSheep[i];
            IdealLean sheepLean = sheep.Ideals.GetIdealLean(idealType);

            if (lean == IdealLean.Positive && sheepLean == IdealLean.Negative)
            {
                flippingSheep.Add(sheep);
            }
            else if (lean == IdealLean.Negative && sheepLean == IdealLean.Positive)
            {
                flippingSheep.Add(sheep);
            }

            sheep.SetState(SheepState.Idle);
        }

        // Choose an amount to flip and flip 'em!
        int amountToFlip = 0;

        if (flippingSheep.Count <= 5)
        {
            amountToFlip = flippingSheep.Count;
        }
        else
        {
            amountToFlip = (int)((float)flippingSheep.Count * UnityEngine.Random.Range(0.5f, 1f));
        }

        for (int i = 0; i < amountToFlip; i++)
        {
            Sheep flipSheep = flippingSheep[i];

            //float prevLean = flipSheep.Lean;
            flipSheep.Ideals.SetIdealValue(idealType, -flippingSheep[i].Ideals.GetIdealValue(idealType));
            //flipSheep.UpdateLean(player, dictator);

            /*if (flipSheep.Lean != prevLean)
             * {
             *      flipSheep.SetState(SheepState.Newspaper);
             * }*/
        }

        newsHeadline.Hide();

        StartNewsHeadlineCountdown();

        AudioManager.PlaySFXRandom("baa");
        AudioManager.PlaySFX("sheep-move");

        playerControls.Show();
        playerControls.ShowNewCards();
    }
Beispiel #2
0
    public void InitHeadline(IdealType ideal, IdealLean idealLean, string headline)
    {
        this.currentIdeal = ideal;
        this.idealLean    = idealLean;

        headlineText.text = headline;

        isHeadlineInitialised = true;
        responded             = false;
    }