예제 #1
0
파일: GameStateManager.cs 프로젝트: GDxU/pb
    public void generateWorld()
    {
        Debug.Log("generating world");
        Physics.gravity            = new Vector3(0, 0, 1f);
        this.mapGenerationSettings = MapGenerationSettings.loadSettings(applicationPersistentPath);
        this.mapData = MapData.loadData(applicationPersistentPath);
        UIController.getInstance().updateSettingsPanel(this.mapGenerationSettings, 0);
        Map map = MapGenerator.generateMap(0, mapGenerationSettings, mapData, applicationPersistentPath, this.randomGenerator);

        //UIController.getInstance().setCameraPosition(HexMathHelper.hexToWorldCoords(MapGenerator.mapCenter(this.mapGenerationSettings), MeshMapController.getInstance().getHexSize()));
        MeshMapController.getInstance().map = map;
        MeshMapController.getInstance().drawMap();

        this.partyGenerationSettings = PartyGenerationSettings.loadSettings(applicationPersistentPath);
        Party party = PartyGenerator.getInstance().generateParty(applicationPersistentPath, this.partyGenerationSettings);

        PartyController.getInstance().party = party;
        PartyController.getInstance().setInitialPosition(MapGenerator.mapCenter(this.mapGenerationSettings));

        UIController.getInstance().showPartyInfo();

        UIController.getInstance().startingMenuPanel.SetActive(false);
        UIController.getInstance().inGamePanel.SetActive(true);

        this.currentTime = this.partyGenerationSettings.nightTime;
    }
예제 #2
0
파일: GameStateManager.cs 프로젝트: GDxU/pb
 public void moveParty(int movementCost, Vector2 hexCoordinates)
 {
     for (int i = 0; i < movementCost; i++)
     {
         this.passTurn();
     }
     PartyController.getInstance().setPosition(hexCoordinates);
 }
예제 #3
0
    public void highlightHex(Vector2 hexCoordinates)
    {
        float   hexSize = MeshMapController.getInstance().getHexSize();
        Vector2 newHighlightPosition = HexMathHelper.hexToWorldCoords(hexCoordinates, hexSize);

        this.transform.position = new Vector3(newHighlightPosition.x, newHighlightPosition.y, this.transform.position.z);
        this.gameObject.SetActive(true);
        int movementCost = PartyController.getInstance().calculateMovementCost(hexCoordinates);

        //this.showMovementCost(movementCost);
        this.showHexCoordinates("x:" + hexCoordinates.x + ", y:" + hexCoordinates.y);

        this.movementCost   = movementCost;
        this.movementTarget = hexCoordinates;
    }
예제 #4
0
파일: UIController.cs 프로젝트: GDxU/pb
    public void highlightTile()
    {
        Vector3 mouseWorldPosition = mainCamera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 10));
        Ray     ray   = mainCamera.ScreenPointToRay(Input.mousePosition);
        float   enter = 0.0f;

        if (mapPlane.Raycast(ray, out enter))
        {
            mouseWorldPosition = ray.GetPoint(enter);
        }

        float   hexSize             = MeshMapController.getInstance().getHexSize();
        Vector2 newlyHighlightedHex = HexMathHelper.worldToHexCoords(mouseWorldPosition, hexSize);

        if (newlyHighlightedHex != this.highightedHex && HexMathHelper.hexDistance(newlyHighlightedHex, PartyController.getInstance().partyPosition) < 10)
        {
            this.highightedHex = newlyHighlightedHex;
            hexHighlightController.highlightHex(this.highightedHex);
        }
        else if (newlyHighlightedHex != this.highightedHex)
        {
            hexHighlightController.hideHighlight();
            this.highightedHex = new Vector2(0, 0);
        }
    }
예제 #5
0
 public void showPartyInfo()
 {
     this.partyText.text = PartyController.getInstance().party.ToString();
 }