예제 #1
0
    void AddLoc(HexLoc loc)
    {
        int        randHeight = Random.Range(0, 3);
        int        yRot       = Random.Range(0, 6) * 60;
        Quaternion rot        = Quaternion.Euler(0, yRot, 0);
        Vector3    worldLoc   = loc.ToWorld() + (Vector3.up * randHeight * 0.25f);
        HexTile    t          = (Instantiate(Resources.Load("Tile"), worldLoc, rot) as GameObject).GetComponent <HexTile>();

        t.height           = randHeight;
        t.transform.parent = transform;
        t.loc = loc;
        locs.Add(loc, t);
        for (int i = randHeight - 1; i >= 0; i--)
        {
            HexLoc     newLoc    = loc;
            Vector3    worldLoc2 = newLoc.ToWorld() + (Vector3.up * i * 0.25f);
            GameObject nt        = Instantiate(Resources.Load("TileBlank"), worldLoc2, Quaternion.identity) as GameObject;
            nt.transform.parent = t.transform;
        }
    }
예제 #2
0
 public Vector3 WorldLoc()
 {
     return(loc.ToWorld() + (Vector3.up * height * 0.25f));
 }
예제 #3
0
 public void FocusCam(HexLoc loc)
 {
     transform.position = loc.ToWorld();
 }