コード例 #1
0
    IEnumerator VillagerPhase()
    {
        VillageTile currentTile = gameBoard.getCurrentTile(this);

        string[]             options = new string[] { "Request help from " + currentTile.tilename, "Attempt Exorcism", "Pass" };
        string[]             buttons = new string[] { "A", "X", "B" };
        GSCoroutine <string> mcq     = io.getButtonPressDialog("What would you like to do?", options, buttons);

        yield return(mcq.coroutine);

        GS.displayInfoMessage(mcq.result);
        switch (mcq.result)
        {
        case "A":
            GS.displayInfoMessage(currentTile.tilename + " is busy, try again later.");
            break;

        case "X":
            yield return(StartCoroutine(gameBoard.attemptExorcism(this)));

            break;

        case "B":
            GS.displayInfoMessage("Passing turn");
            break;
        }
        yield return(new WaitForSeconds(1f));
    }
コード例 #2
0
    IEnumerator MovePhase()
    {
        GS.displayInfoMessage(displayName() + " has entered the move phase.");
        gameBoard.getPossibleMoves(this);
        while (true)
        {
            io.startHoverInfo();
            GSCoroutine <GameObject> clickedGSC = io.getClickedGameObject("_VillageTile");
            yield return(clickedGSC.coroutine);

            while (clickedGSC.result == null)
            {
                yield return(null);
            }
            GridSpace   targetgs = clickedGSC.result.GetComponent <GridSpace>();
            VillageTile vt       = targetgs.VillageTile;
            string      target   = vt.tilename;


            if (gameBoard.movePlayer(this, target))
            {
                GS.displayInfoMessage(displayName() + " is moving to " + target);
                break;
            }
            else
            {
                GS.displayWarnMessage(displayName() + " cannot go there");
            }

            yield return(null);
        }
        GS.displayInfoMessage(displayName() + " has finished the move phase.");
    }
コード例 #3
0
ファイル: TilesDataManager.cs プロジェクト: Aye1/BuildAnew2D
    public StructureTile CreateStructureFromType(StructureType type, BaseTileData data)
    {
        StructureTile newTile = null;

        StructureBinding structureBinding = BuildingManager.Instance.StructuresTemplates.GetStructureBindingFromType(type);

        if (structureBinding != null)
        {
            switch (type)
            {
            case StructureType.PowerPlant:
                newTile = new PowerPlantTile();
                break;

            case StructureType.Sawmill:
                newTile = new SawmillTile();
                break;

            case StructureType.PumpingStation:
                newTile = new PumpingStationTile();
                WaterClusterManager.Instance.RegisterPumpingStation(data);
                break;

            case StructureType.Village:
                newTile = new VillageTile();
                break;

            case StructureType.Mine:
                newTile = new MineTile();
                break;

            case StructureType.Relay:
                newTile = new RelayTile();
                break;

            case StructureType.MainRelay:
                newTile = new MainRelayTile();
                break;

            default:
                throw new MissingStructureTypeDefinitionException();
            }
            data.structureTile = newTile;
            BuildingView building = Instantiate(structureBinding.building, data.worldPosition, Quaternion.identity, transform);
            building.dataTile    = newTile;
            newTile._building    = building;
            newTile.GridPosition = data.GridPosition;
            ResourcesManager.Instance.RegisterStructure(newTile);
            RelayManager.Instance.RegisterStructure(data);
        }
        return(newTile);
    }
コード例 #4
0
 public void unhighlight()
 {
     VillageTile.unhighlight();
 }
コード例 #5
0
 public void highlight()
 {
     VillageTile.highlight();
 }