示例#1
0
        public void TestBear3Poly()
        {
            Peacock   Jane = new Peacock();
            BrownBear BoBo = new BrownBear();

            Assert.NotEqual(Jane.NumLegs, BoBo.NumLegs);
        }
示例#2
0
        public void TestOverridden()
        {
            Peacock   Jane = new Peacock();
            BrownBear BoBo = new BrownBear();

            Assert.NotEqual(BoBo.Speak(), Jane.Speak());
        }
示例#3
0
        public void Second_interface_implementation()
        {
            // Arrange
            Peacock peacock = new Peacock();

            // Act
            string result = peacock.Breed();

            // Assert
            Assert.Equal("What beautiful feathers!", result);
        }
示例#4
0
        public void Interface_ineritance_test_bird_to_peacock()
        {
            // Arrange
            Bird peacock = new Peacock();

            // Act
            string result = peacock.Fly();

            // Assert
            Assert.Equal("All of our birds know how to fly, but we will have penguins soon!", result);
        }
    public void PeacockScreenExtra(int extraType)
    {
        Debug.Log("extra peacock " + extraType);
        Transform extras       = PeacockView.transform.Find("ExtraPlan");
        Transform button       = extras.GetChild(extraType);
        Image     img          = button.GetComponent <Image>();
        bool      prevSelected = img.color.a == 1f;

        PeacockExtraType extra = (PeacockExtraType)extraType;
        int price = extra.GetPrice();

        if (!prevSelected && GameData.singleton.money - GameData.singleton.peacockQuarterlyTotalCost < price)
        {
            Debug.Log("not enough money");
            return;
        }

        img.color = new Color(1f, 1f, 1f, prevSelected ? 0.1f : 1f);
        Peacock.SetQuarterlyExtra(extraType, !prevSelected);
        PeacockView.transform.Find("CostTitle/Cost").GetComponent <Text>().text = Utilities.FormatMoney(GameData.singleton.peacockQuarterlyTotalCost);
    }
示例#6
0
        static void Main(string[] args)
        {
            BrownBear BoBo   = new BrownBear();
            Peacock   Jane   = new Peacock();
            Goldfish  Bill   = new Goldfish();
            Salmon    Jasper = new Salmon();
            Turtle    Molly  = new Turtle();
            Snake     Kathy  = new Snake();

            Console.WriteLine("Brownbear Speaks: ");
            BoBo.Speak();

            Console.WriteLine("Peacock Sleeps: ");
            Jane.Sleep();
            Console.WriteLine("Peacock interface Play: ");
            Console.WriteLine(Jane.PlayInterface());
            Console.WriteLine("Peacock interface Potty: ");
            Console.WriteLine(Jane.PottyInterface());

            Console.WriteLine("Goldfish Moves: ");
            Bill.Move();
            Console.WriteLine("Goldfish interface Potty: ");
            Console.WriteLine(Bill.PottyInterface());

            Console.WriteLine("Salmon NumOfBabies");
            Jasper.NumOfBabies = 5;
            Console.WriteLine(Jasper.NumOfBabies);

            Console.WriteLine("Turtle HasShell: ");
            Molly.HasShell = true;
            Console.WriteLine(Molly.HasShell);
            Console.WriteLine("Turtle interface Play: ");
            Console.WriteLine(Molly.PlayInterface());

            Console.WriteLine("Snake HasSpine");
            Kathy.HasSpine = true;
            Console.WriteLine(Kathy.HasSpine);

            Console.ReadLine(); //to stop it from auto exit
        }
示例#7
0
        public void TestPeacock2Inherited()
        {
            Peacock Jane = new Peacock();

            Assert.Equal(2, Jane.NumLegs);
        }
示例#8
0
        public void TestPeacock1Inherited()
        {
            Peacock Jane = new Peacock();

            Assert.True(Jane.HasFeathers);
        }
示例#9
0
        public void TestIsAnAnimal3()
        {
            Peacock Jane = new Peacock();

            Assert.Equal(3, Jane.Move());
        }
示例#10
0
        public void TestIsAnAnimal2()
        {
            Peacock Jane = new Peacock();

            Assert.Equal(1, Jane.Speak());
        }
示例#11
0
        public void TestIsAnAnimal1()
        {
            Peacock Jane = new Peacock();

            Assert.True(Jane.HasSpine); //shouldn't have gotten overridden per my chart
        }
示例#12
0
        public void TestInterfacePeacock3()
        {
            Peacock George = new Peacock();

            Assert.Equal(10, George.PlayInterface());
        }
示例#13
0
        public void TestInterfacePeacock2()
        {
            Peacock George = new Peacock();

            Assert.NotEqual("hi", George.PottyInterface());
        }
示例#14
0
        public void TestInterfacePeacock1()
        {
            Peacock George = new Peacock();

            Assert.Equal("Hello from PottyInterface IPotty Peacock", George.PottyInterface());
        }
    /**
     * Call this at the end of the quarter to setup the peacock view
     */
    public void PreparePeacockSummary()
    {
        for (int i = 0; i < PeacockView.transform.childCount; ++i)
        {
            GameObject go = PeacockView.transform.GetChild(i).gameObject;
            if (go.GetComponent <CanvasGroup>() != null)
            {
                if (GameData.singleton.quarter < 2)
                {
                    go.GetComponent <CanvasGroup>().alpha = 0;
                    FancyUIAnimations.PushFadeIn(go);
                }
            }
        }

        // I assume there's a more proper way to do this, but I'm too lazy to figure it out
        PeacockView.transform.Find("Date").GetComponent <Text>().text             = string.Format("{0}, Year {1}", GameData.singleton.season.GetName(), GameData.singleton.year);
        PeacockView.transform.Find("FoodReport").GetComponent <Text>().text       = GameData.singleton.peacockReportFoodDesc;
        PeacockView.transform.Find("ActivityReport").GetComponent <Text>().text   = GameData.singleton.peacockReportActivityDesc;
        PeacockView.transform.Find("ExtraReport").GetComponent <Text>().text      = GameData.singleton.peacockReportExtraDesc;
        PeacockView.transform.Find("StatusReport").GetComponent <Text>().text     = GameData.singleton.peacockReportGeneralDesc;
        PeacockView.transform.Find("NextQuarterTitle").GetComponent <Text>().text = string.Format("Plan for the {0}: ", GameData.singleton.season.GetNextSeasonName());

        Transform foodPlan = PeacockView.transform.Find("FoodPlan");

        for (int i = (int)FoodType.FT_MAX - 1; i >= 0; --i)
        {
            FoodType  food   = ((FoodType)i);
            Transform button = foodPlan.GetChild(i);
            button.GetChild(0).GetComponent <Text>().text = food.GetLabel();
            bool isActiveFood = (int)GameData.singleton.peacockQuarterlyFoodType == i;
            if (isActiveFood)
            {
                // if we can no longer afford the food we previously bought, force a downgrade
                int price = food.GetPrice();
                if (price > GameData.singleton.money)
                {
                    isActiveFood = false;
                    GameData.singleton.peacockQuarterlyFoodType = (FoodType)(i - 1); // assumption: the first available food type is free
                    GameData.singleton.peacockQuarterlyFoodCost = GameData.singleton.peacockQuarterlyFoodType.GetPrice();
                }
            }

            button.GetComponent <Image>().color = new Color(1f, 1f, 1f, isActiveFood ? 1f : PEACOCK_SCREEN_UNSELECTED_ALPHA);
        }

        Transform activityPlan = PeacockView.transform.Find("ActivityPlan");

        for (int i = 0; i < (int)PeacockActivityType.PA_MAX; ++i)
        {
            PeacockActivityType activity = ((PeacockActivityType)i);
            Transform           button   = activityPlan.GetChild(i);
            button.GetChild(0).GetComponent <Text>().text = activity.GetLabel();
            if ((int)GameData.singleton.peacockQuarterlyActivity == i)
            {
                button.GetComponent <Image>().color = new Color(1f, 1f, 1f, 1f);
            }
        }

        Transform extraPlan = PeacockView.transform.Find("ExtraPlan");

        for (int i = 0; i < (int)PeacockExtraType.ET_MAX; ++i)
        {
            PeacockExtraType extra  = ((PeacockExtraType)i);
            Transform        button = extraPlan.GetChild(i);
            button.GetChild(0).GetComponent <Text>().text = extra.GetLabel();
            button.GetComponent <Image>().color           = new Color(1f, 1f, 1f, Peacock.HasQuarterlyExtra(i) ? 1f : PEACOCK_SCREEN_UNSELECTED_ALPHA);
        }

        PeacockView.transform.Find("CostTitle/Cost").GetComponent <Text>().text = Utilities.FormatMoney(GameData.singleton.peacockQuarterlyTotalCost);
    }
示例#16
0
 /**
  * End of all sales and events for the current quarter (but special game-over events could trigger after this, still
  */
 public static void CurrentQuarterEnding()
 {
     Peacock.EndOfQuarter();
 }