예제 #1
0
        public void InitaliseDevelopableLandWithCorrectData()
        {
            int[] rentTable = new int[6] {
                30, 60, 100, 150, 200, 320
            };
            int             price   = 200;
            Colour          group   = Colour.Blue;
            DevelopableLand reyLane = new DevelopableLand("Rey Lane", price, group, rentTable);

            // correct name
            Assert.AreEqual("Rey Lane", reyLane.GetPropertyName());
            // correct price
            Assert.AreEqual(200, reyLane.GetPrice());
            // correct group
            Assert.AreEqual(Colour.Blue, reyLane.GetColourGroup());
            // correct rent table
            var actualRentTable = reyLane.GetRentTable();

            for (int i = 0; i < 5; i++)
            {
                Assert.AreEqual(rentTable[i], actualRentTable[i]);
            }
            // initially unowned
            Assert.IsNull(reyLane.GetOwner());
            // initially unmortgaged
            Assert.IsFalse(reyLane.IsMortgaged());
            // initially undeveloped
            Assert.AreEqual(0, reyLane.GetHouses());
            // implements IProperty interface
            Assert.IsTrue(reyLane is IProperty);
        }
예제 #2
0
    int spaceID = 1; //change this and the script name I suppose...

    // Use this for initialization
    void Start()
    {
        controller       = GameObject.Find("GameController");
        controllerScript = controller.GetComponent <ControllerScript>();
        // don't check what space the current player is on because they don't need to be on the space to view the property info
        // instead we will hard code the board space number to each script and copy and paste...
        PropertyTycoon game     = controllerScript.game;
        PropertySpace  space    = ((PropertySpace)game.GetBoardSpace(spaceID));
        IProperty      property = space.GetProperty();

        if (property.IsDevelopable())
        {
            DevelopableLand devLand = (DevelopableLand)property;
            if (devLand.GetColourGroup() == Colour.Blue)
            {
                this.GetComponent <UnityEngine.UI.Image>().color = Color.cyan;
            }
            else if (devLand.GetColourGroup() == Colour.Brown)
            {
                this.GetComponent <UnityEngine.UI.Image>().color = new Color(165, 42, 42);
            }
            else if (devLand.GetColourGroup() == Colour.DeepBlue)
            {
                this.GetComponent <UnityEngine.UI.Image>().color = Color.blue;
            }
            else if (devLand.GetColourGroup() == Colour.Green)
            {
                this.GetComponent <UnityEngine.UI.Image>().color = Color.green;
            }
            else if (devLand.GetColourGroup() == Colour.Orange)
            {
                this.GetComponent <UnityEngine.UI.Image>().color = new Color(255, 165, 0);
            }
            else if (devLand.GetColourGroup() == Colour.Purple)
            {
                this.GetComponent <UnityEngine.UI.Image>().color = new Color(160, 32, 240);
            }
            else if (devLand.GetColourGroup() == Colour.Red)
            {
                this.GetComponent <UnityEngine.UI.Image>().color = Color.red;
            }
            else if (devLand.GetColourGroup() == Colour.Yellow)
            {
                this.GetComponent <UnityEngine.UI.Image>().color = Color.yellow;
            }
        }
    }
예제 #3
0
        public void DevelopableLand_GetDevelopCost()
        {
            int[] rentTable = new int[6] {
                60, 70, 80, 90, 100, 200
            };
            DevelopableLand ibisClose = new DevelopableLand("Ibis Close", 400, Colour.DeepBlue, rentTable);

            // Deep Blue houses = £200
            Assert.AreEqual(Colour.DeepBlue, ibisClose.GetColourGroup());
            Assert.AreEqual(200, ibisClose.GetDevelopCost());

            DevelopableLand picardAvenue = new DevelopableLand("Picard Avenue", 260, Colour.Yellow, rentTable);

            // Yellow houses = £150
            Assert.AreEqual(Colour.Yellow, picardAvenue.GetColourGroup());
            Assert.AreEqual(150, picardAvenue.GetDevelopCost());

            DevelopableLand pennyLane = new DevelopableLand("Penny Lane", 260, Colour.Orange, rentTable);

            // Orange houses = £100
            Assert.AreEqual(Colour.Orange, pennyLane.GetColourGroup());
            Assert.AreEqual(100, pennyLane.GetDevelopCost());
        }