Exemplo n.º 1
0
 public List <GameObject> GetLinkObjects(BuildingLink buildLink, Type objType)
 {
     if (StructBuildings.ContainsKey(buildLink))
     {
         List <LinkObject> foundList = StructBuildings[buildLink].FindAll(obj => obj.GetType() == objType);
         List <GameObject> goList    = new List <GameObject>();
         foreach (LinkObject lObj in foundList)
         {
             goList.Add(lObj.gameObject);
         }
         return(goList);
     }
     else
     {
         return(new List <GameObject>());
     }
 }
Exemplo n.º 2
0
        public GameObject CreateSavedProps(GameObject model, Vector3 pos, Cell associateCell, Quaternion orientation, BuildingLink link)
        {
            Type       subType = model.GetType();
            LinkObject item;
            Props      modelProps = model.GetComponent <Props>();

            if (modelProps == null)
            {
                return(null);
            }
            Props newGo = Instantiate(modelProps, pos, orientation, associateCell.transform);

            newGo.associateCell       = associateCell;
            newGo.transform.position += pos.normalized * newGo.offsetY;
            if (newGo.GetComponent <LinkObject>())
            {
                item = newGo.GetComponent <LinkObject>();
                item.BuildingLink = link;
                item.Creation();
            }
            associateCell.Props.Add(newGo, model.name);
            associateCell.PropsCollider.Add(newGo, newGo.GetCollider());
            newGo.Init();
            return(newGo.gameObject);
        }
Exemplo n.º 3
0
 public OnPropsLinkCreation(BuildingLink pBuilding, LinkObject cObj)
 {
     buildingStruct = pBuilding;
     obj            = cObj;
 }
Exemplo n.º 4
0
 public bool Equal(BuildingLink buildTest)
 {
     return((buildTest.id == id && buildTest.type == type) ? true : false);
 }