Esempio n. 1
0
    public IEnumerator <object> PlayerMove()
    {
        Debug.Log("Move has been clicked");
        HexCoordinate Phex = (HexCoordinate)player.GetLocation();

        Debug.Log(player.MoveRemaining());
        while (player.MoveRemaining() > 0)
        {
            while (Input.GetMouseButtonDown(0) == false)
            {
                Debug.Log("Please Work" + Input.GetMouseButtonDown(0)); yield return(null);
            }
            Debug.Log("MouseHasBeenClicked");
            HexCoordinate hex = MousePostion();
            if (!GameManager._instance.gameState.gameBoard.CanCreateRoom(hex))    //Checks if room is there
            {
                if (GameManager._instance.gameState.gameBoard.canMove(Phex, hex)) //Room is there, check if there is a valid door
                {
                    Debug.Log("I'm Moving from " + Phex.ToString() + " To " + hex.ToString());
                    player.MovePlayer(hex);
                }
            }
            else                                                                //create tile
            {
                if (GameManager._instance.gameState.gameBoard.hasNeighbor(hex)) //Checks if tile has valid neighbor
                {
                    Debug.Log("NewTilePlz");
                    GameManager._instance.gameState.gameBoard.CreateRoom(hex);
                    player.MoveToZero();
                }
            }
            yield return(new WaitForEndOfFrame());
        }
    }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        HexCoordinate coordinate = new HexCoordinate(
            property.FindPropertyRelative("x").intValue,
            property.FindPropertyRelative("z").intValue);

        position = EditorGUI.PrefixLabel(position, label);
        GUI.Label(position, coordinate.ToString());
    }
Esempio n. 3
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        HexCoordinate coordinates = new HexCoordinate(property.FindPropertyRelative("x").intValue, property.FindPropertyRelative("z").intValue);

        EditorGUI.LabelField(position, label.text, coordinates.ToString());
    }