Esempio n. 1
0
    /// <summary>
    /// Spawns 7 tiles around the index passed in and then places a throne building the index hex
    /// </summary>
    /// <param name="index">The middle hex index</param>
    private void SetStartTiles(int index = 302)
    {
        Hexes.ElementAt(index).IsCreep = true;
        RaycastHit hit;

        Physics.Raycast(FindHexObject(Hexes.ElementAt(index).hex.cubeCoords).transform.position - Vector3.up, Vector3.down, out hit, 2f);

        GameObject throne = Instantiate(thronePrefab);

        throne.transform.position = new Vector3(FindHexObject(Hexes.ElementAt(index).hex.cubeCoords).transform.position.x, hit.point.y, FindHexObject(Hexes.ElementAt(index).hex.cubeCoords).transform.position.z);

        Hex.Neighbours(Hexes.ElementAt(index).hex).ToList().ForEach(h => FindHexObject(h.cubeCoords).IsCreep = true);
    }
Esempio n. 2
0
    public HexObject GetHexObjectAt(Vector3 position)
    {
        var coord = GetCubeCoordAt(position);

        return(Hexes.ElementAt((int)(coord.X + coord.Z * Width)));
    }