public TerrainChunk(OmniTerrain parent,int x, int y,int size) { OmniTerrain.loadedChunks.Add(this); OmniTerrain.chunks[x + y * size] = this; if (OmniTerrain.biomes.ContainsKey(x + y * size)) biome = OmniTerrain.biomes[x + y * size]; objects = new List<OmniObject>(); pendingSlantUpdates = new List<int>(); atlas = TPackManager.getAtlas ("World"); pos = new Vector3 ((int)(x*size), (int)(y*size), 0); mesh = new Mesh[] { new Mesh(), new Mesh() }; chunksize = size; slant = new byte[chunksize * chunksize]; for (int i = 0; i < slant.Length; i++) { slant[i] = 0; } this.parent = parent; if (Network.isClient) { RChunkEvent e = new RChunkEvent(OmniWorld.tick); e.x = (int)x; e.y = (int)y; e.player = Network.player; OmniEvents.AddEvent(e); } else { loaded = true; GenDamageMap(size); GenBiomes(size); GenSlant(); GenMesh(1); } }
// Use this for initialization void Start() { terrain = GetComponent<OmniTerrain>(); world = GetComponent<OmniWorld>(); snapshot = new MemoryStream(); snapshot_reader = new BinaryReader(snapshot); snapshot_writer = new BinaryWriter(snapshot); cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>(); }
void Start() { terrain = GetComponent<OmniTerrain>(); GUICreateWorld.show = true; bool dedicated = false; /* // if (Application.platform != RuntimePlatform.WindowsWebPlayer)// && Application.platform != RuntimePlatform.WindowsEditor) // { string[] args = Environment.GetCommandLineArgs(); if (args != null) for (int i = 0; i < args.Length; i++) { if (args[i] == "-dedicated") { if (i < args.Length - 2) { worldName = args[i + 1]; OmniLocal.localName = args[i + 2]; } dedicated = true; } } // } /* else { OmniCreateCharacterNet.show = true; } * */ if (MakeDedicated) dedicated = true; if (dedicated) { if (worldName == "") worldName = "OmniWorld"; if (OmniLocal.localName == "") OmniLocal.localName = "Player"; OmniNetwork.Dedicated = true; StartWorld(); GUICreateWorld.show = false; } }
void OnEnable() { frustrum = new Vector3[] { new Vector3 (0, 0, 0), new Vector3 (1, 1, 0), new Vector3 (1, 0, 0), }; instance = this; }