Пример #1
0
    public static WorldMap BuildBZW()
    {
        WorldMap map = new WorldMap();

        BZWWorld root = GameObject.FindObjectOfType <BZWWorld>();

        if (root == null)
        {
            return(null);
        }

        if (root.Name == string.Empty)
        {
            map.WorldInfo.Name = "Untitled BZW";
        }

        map.WorldInfo = root.ToBZWObject() as BZFlag.Map.Elements.World;

        for (int i = 0; i < root.gameObject.transform.childCount; i++)
        {
            var child = root.transform.GetChild(i);

            BZWBasicObject opt = child.GetComponent <BZWBasicObject>();
            if (opt != null)
            {
                map.AddObject(opt.ToBZWObject());
            }
        }
        return(map);
    }
Пример #2
0
 public void RebuildGeoInChildren(GameObject obj)
 {
     foreach (Transform child in obj.transform)
     {
         BZWBasicObject b = GetMapObject(child.gameObject);
         if (b != null)
         {
             b.BuildGeometry();
         }
         RebuildGeoInChildren(child.gameObject);
     }
 }
Пример #3
0
    public BZWBasicObject GetMapObject(GameObject obj)
    {
        BZWBasicObject b = obj.GetComponent <BZWBasicObject>();

        if (b != null)
        {
            return(b);
        }

        b = obj.GetComponent <BZWUnknown>();
        if (b != null)
        {
            return(b);
        }

        b = obj.GetComponent <BZWWorld>();
        if (b != null)
        {
            return(b);
        }

        b = obj.GetComponent <BZWOptions>();
        if (b != null)
        {
            return(b);
        }

        b = obj.GetComponent <BZWPhaseableObject>();
        if (b != null)
        {
            return(b);
        }

        b = obj.GetComponent <BZWPyramid>();
        if (b != null)
        {
            return(b);
        }

        b = obj.GetComponent <BZWBox>();
        if (b != null)
        {
            return(b);
        }

        b = obj.GetComponent <BZWBase>();
        if (b != null)
        {
            return(b);
        }

        b = obj.GetComponent <BZWLink>();
        if (b != null)
        {
            return(b);
        }

        b = obj.GetComponent <BZWTeleporter>();
        if (b != null)
        {
            return(b);
        }

        b = obj.GetComponent <BZWZone>();
        if (b != null)
        {
            return(b);
        }

        b = obj.GetComponent <BZWPhysics>();
        if (b != null)
        {
            return(b);
        }

        return(null);
    }
Пример #4
0
    private static void DeleteBZWComponents(GameObject obj)
    {
        BZWBasicObject b = obj.GetComponent <BZWBasicObject>();

        if (b != null)
        {
            GameObject.DestroyImmediate(b);
        }

        b = obj.GetComponent <BZWUnknown>();
        if (b != null)
        {
            GameObject.DestroyImmediate(b);
        }

        b = obj.GetComponent <BZWWorld>();
        if (b != null)
        {
            GameObject.DestroyImmediate(b);
        }
        ;

        b = obj.GetComponent <BZWOptions>();
        if (b != null)
        {
            GameObject.DestroyImmediate(b);
        }

        b = obj.GetComponent <BZWPhaseableObject>();
        if (b != null)
        {
            GameObject.DestroyImmediate(b);
        }

        b = obj.GetComponent <BZWPyramid>();
        if (b != null)
        {
            GameObject.DestroyImmediate(b);
        }

        b = obj.GetComponent <BZWBox>();
        if (b != null)
        {
            GameObject.DestroyImmediate(b);
        }

        b = obj.GetComponent <BZWBase>();
        if (b != null)
        {
            GameObject.DestroyImmediate(b);
        }

        b = obj.GetComponent <BZWLink>();
        if (b != null)
        {
            GameObject.DestroyImmediate(b);
        }

        b = obj.GetComponent <BZWTeleporter>();
        if (b != null)
        {
            GameObject.DestroyImmediate(b);
        }

        b = obj.GetComponent <BZWZone>();
        if (b != null)
        {
            GameObject.DestroyImmediate(b);
        }
    }