public void destroySceneryObject(GameObject obj) { SceneryObject sc_obj = obj.GetComponent <SceneryObject> (); TChunk chunk = loaded_chunks.getElem(sc_obj.chunk_index_x, sc_obj.chunk_index_y); chunk.generator.destroySceneryObject(obj, ref Scenery_Obj_Pool); }
private void AddScenery(Vector3 pos) { SceneryObject SObj = new SceneryObject(Toolbox.SceneryOpt); SObj.PlaceObject(pos, Quaternion.identity, Vector3.one); SObj.Chargeable = true; Scenery.Instance.Objects.Add(SObj); SObj.Select(); }
private void CopyCurrentScenery() { SceneryObject SObj = new SceneryObject(PlaceableObject.Current.Opt); SObj.PlaceObject(PlaceableObject.Current.Pos + Vector3.right * 5, PlaceableObject.Current.Rot, PlaceableObject.Current.Scale); SObj.Chargeable = true; Scenery.Instance.Objects.Add(SObj); SObj.Select(); Game.current.Dirty = true; }
void AddScenery(BattleField field) { FileLocation fl = FileSystem.Instance.Locate("sceneObjects.xml", GameFileLocs.Config); Configuration config = ConfigurationManager.Instance.CreateInstance(fl); foreach (KeyValuePair <string, ConfigurationSection> e in config) { ConfigurationSection sect = e.Value; SceneryObject obj = new SceneryObject(field); obj.Parse((GameConfigurationSection)sect); obj.InitalizeGraphics(renderSys); scene.Scene.AddObjectToScene(obj); } }
// Instantiate the object and put it on the screen private void CreateObject(GameObject dungeonObj, int x, int y, Vector2 offset, int gridValue) { GameObject tile = GameObject.Instantiate(dungeonObj, mConfig.parentObject.transform) as GameObject; SceneryObject so = tile.GetComponent <SceneryObject>(); Vector2 position = new Vector2(x, y); tile.transform.position = position + offset; for (int k = so.height - 1; k >= 0; k--) { for (int j = 0; j < so.width; j++) { gridCopy[(int)tile.transform.position.x + j, (int)tile.transform.position.y - k] = gridValue; } } }
public PlaceableObject Decode() { PlaceableObject rtn; switch (Type) { case "StartingLine": rtn = new StartingLine(name); break; default: rtn = new SceneryObject(name); break; } rtn.prefab = prefab; rtn.Pos = pos.V3; try { rtn.Scale = Scale.V3; } catch { rtn.Scale = Vector3.one; } rtn.Rot = rot.Decode; rtn.Addressable = Addressable; return(rtn); }
public Instance(SceneryObject obj, IEnumerable <string> datarefs)