Beispiel #1
0
    static public CreatePlane CreatePlan(string root, string materialRoot, Vector3 origen = new Vector3(), string name = "", Transform container = null,
                                         H hType = H.None, float raiseFromFloor = 0.09f, Material mat = null, Vector3 scale = new Vector3(), bool isAnInvisiblePlane = false)
    {
        WAKEUP = true;
        CreatePlane obj = null;

        obj                = (CreatePlane)Resources.Load(root, typeof(CreatePlane));
        obj                = (CreatePlane)Instantiate(obj, origen, Quaternion.identity);
        obj.HType          = hType;
        obj.transform.name = obj.MyId = obj.Rename(obj.transform.name, obj.Id, obj.HType, name);
        obj.Scale          = scale;

        if (mat == null)
        {
            obj.Material = (Material)Resources.Load(materialRoot);
        }
        else
        {
            obj.Material = mat;
        }

        obj.RaisedFromFloor    = raiseFromFloor;
        obj.IsAnInVisiblePlane = isAnInvisiblePlane;

        if (container != null)
        {
            obj.transform.SetParent(container);
        }
        return(obj);
    }
Beispiel #2
0
    /// <summary>
    /// Will find which tile is like NE corner
    /// </summary>
    static public CreatePlane CreatePlanSmartTile(Building spawner, string root, string materialRoot, Vector3 origen = new Vector3(), string name = "", Transform container = null,
                                                  float raiseFromFloor   = 0.09f, Material mat = null, Vector3 scale = new Vector3(), bool isAnInvisiblePlane = false,
                                                  bool isLoadingFromFile = false)
    {
        //root = "Prefab/Mats/SmartTile/Road3D/In";

        WAKEUP = true;
        CreatePlane obj = null;

        obj                = (CreatePlane)Resources.Load(root, typeof(CreatePlane));
        obj                = (CreatePlane)Instantiate(obj, origen, Quaternion.identity);
        obj.HType          = spawner.HType;
        obj.transform.name = obj.MyId = obj.Rename(obj.transform.name, obj.Id, obj.HType, name);
        obj.Scale          = scale;

        //if (mat == null)
        //{
        //    obj.Material = (Material)Resources.Load(materialRoot);
        //}
        //else obj.Material = mat;

        obj.RaisedFromFloor    = raiseFromFloor;
        obj.IsAnInVisiblePlane = isAnInvisiblePlane;

        if (container != null)
        {
            obj.transform.SetParent(container);
        }

        obj.SpawnerId         = spawner.MyId;
        obj.IsLoadingFromFile = isLoadingFromFile;
        obj.IsSmartTile       = true;
        return(obj);
    }