Esempio n. 1
0
        public void CreateInstructionSpace()
        {
            PayAction        pay200 = new PayAction(200, Recipient.Bank);
            InstructionSpace payTax = new InstructionSpace(pay200);

            // correct instruction stored
            Assert.AreEqual(pay200, payTax.GetInstruction());
            // implements IBoardSpace interface
            Assert.IsTrue(payTax is IBoardSpace);
        }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        GameObject       controller       = GameObject.Find("GameController");
        ControllerScript controllerScript = controller.GetComponent <ControllerScript>();
        PropertyTycoon   game             = controllerScript.game;

        space = game.GetBoardSpace(spaceID);
        Debug.Log(space.GetType());

        // dynamic text based on type of board space
        // assumes you're using Text Mesh Pro UGUI component
        if (space.GetType() == typeof(GoSpace))
        {
            GetComponent <TextMeshProUGUI>().text = spaceID + "\n\nGo!";
            Debug.Log("Found a go space");
        }
        else if (space.GetType() == typeof(JailSpace))
        {
            GetComponent <TextMeshProUGUI>().text = "Just Visiting / Jail Space";
        }
        else if (space.GetType() == typeof(FreeParkingSpace))
        {
            GetComponent <TextMeshProUGUI>().text = "Free Parking";
        }
        else if (space.GetType() == typeof(PropertySpace))
        {
            // cast and get property object and display name
            PropertySpace propertySpace = (PropertySpace)space;
            IProperty     property      = propertySpace.GetProperty();
            GetComponent <TextMeshProUGUI>().text = spaceID + "\n\n\n" + property.GetPropertyName();
        }
        else if (space.GetType() == typeof(InstructionSpace))
        {
            // cast and get instruction object and display description
            InstructionSpace instructionSpace = (InstructionSpace)space;
            string           description      = instructionSpace.GetDescription();
            GetComponent <TextMeshProUGUI>().text = spaceID + "\n\n" + description;
        }
    }