Beispiel #1
0
        public List <TileBehavior> FindBuildableTiles()
        {
            TileBehavior[] tiles   = grid.Tiles;
            bool[]         visited = new bool[tiles.Length];
            ColonyBehavior colony  = GameObject.Find("colony").GetComponent <ColonyBehavior> ();

            return(FindEmptyAdjacent((int)colony.Nucleus.transform.position.x, (int)colony.Nucleus.transform.position.y,
                                     tiles, visited));
        }
    void OnMouseDown()
    {
        TileQuery q = new TileQuery();

        if (!q.CanBuildAt(x, y))
        {
            return;
        }
        CellChoiceBehavior[] behaviors = FindObjectsOfType <CellChoiceBehavior> ();
        foreach (CellChoiceBehavior b in behaviors)
        {
            if (b.IsSelected)
            {
                ColonyBehavior colony = GameObject.Find("colony").GetComponent <ColonyBehavior> ();
                cell = colony.MakeCell(b.CellType, x, y);
            }
        }
        // new cell was created
        if (cell != null)
        {
            Events.Trigger("PlaceCell", cell);
        }
    }
 // Use this for initialization
 protected void Start()
 {
     colony = GameObject.Find("colony").GetComponent <ColonyBehavior> ();
 }
 // Use this for initialization
 protected void Start()
 {
     colony = GameObject.Find ("colony").GetComponent<ColonyBehavior> ();
 }