void Awake() { myButton = GetComponent <Button>(); // <-- you get access to the button component here myButton.onClick.AddListener(VerifFormule); // <-- you assign a method to the button OnClick event here focusHandler = (FocusHandler)GameObject.Find("Canvas/PanelDessous/FormulePan").GetComponent <FocusHandler>(); terrainHandler = (TerrainHandler)GameObject.Find("Plane").GetComponent <TerrainHandler>(); }
public TerrainChunk(TerrainHandler handler, Vector3 position, int3 chunkSize, Material terrainMat) { this.handler = handler; this.position = position; this.chunkSize = chunkSize; chunkObject = new GameObject("Chunk Object: " + position); chunkObject.transform.position = position; chunkObject.transform.SetParent(handler.gameObject.transform, true); this.terrainMat = terrainMat; }
/// <summary> /// Main loop, runs the WebSocket connection. /// </summary> protected void RunSocket() { //We don't really need to store the handlers; //just create them and let them call our EnqueueMessage method. //XXX automatically find these like WebServer does. Log($"Creating socket handlers (thread: {Thread.CurrentThread.Name})"); BudgetHandler budgetHandler = new BudgetHandler(this); BuildingHandler buildingHandler = new BuildingHandler(this); CameraHandler cameraHandler = new CameraHandler(this); ChirperHandler chirperHandler = new ChirperHandler(this); CitizenHandler citizenHandler = new CitizenHandler(this); CityInfoHandler cityInfoHandler = new CityInfoHandler(this); DebugHandler debugHandler = new DebugHandler(this); DistrictHandler districtHandler = new DistrictHandler(this); FlagsHandler flagsHandler = new FlagsHandler(this); InstancesHandler instancesHandler = new InstancesHandler(this); LimitsHandler limitsHandler = new LimitsHandler(this); NotificationHandler notificationHandler = new NotificationHandler(this); ReflectionHandler reflectionHandler = new ReflectionHandler(this); TerrainHandler terrainHandler = new TerrainHandler(this); TransportHandler transportHandler = new TransportHandler(this); VehicleHandler vehicleHandler = new VehicleHandler(this); Log("Waiting for messages"); try { while (true) { if (stream.DataAvailable) { HandleNextMessage(); } String msg = GetNextOutgoingMessage(); if (msg != null) { byte[] buf = Encoding.UTF8.GetBytes(msg); SendFrame(buf); } Thread.Sleep(100); } } catch (ObjectDisposedException) { //we're done, stream is closed Log("Connection closed"); } catch (OperationCanceledException) { Log("Connection closed"); } }
public void Start() { vertices = new List <Vector3>(); triangles = new List <int>(); uvs = new List <Vector2>(); map = new byte[chunkX, chunkY, chunkZ]; blocks = Block.GetBlocks(); terrainHandler = new TerrainHandler(); LoadMap(); SetMeshData(); MakeMesh(); Debug.Log("Vertices: " + vertices.Count); Debug.Log("Triangles: " + triangles.Count / 3); }
void OnMouseDown() { // Debug.Log("tile: " + x + " : " + y + " CLICK"); if (_flower) { TerrainHandler terrain = this.transform.parent.gameObject.GetComponent <TerrainHandler>(); TerrainHandler.ToggleType mode = terrain.getMode(); if (mode == TerrainHandler.ToggleType.Create) { _flower.setXY((float)x, (float)y); terrain.getJardin().Add(_flower.copyToElement()); } if (mode == TerrainHandler.ToggleType.Delete) { if (_flower.isAttribuate()) { _flower.setXY(-42, -42); _flower.destroyFlower(terrain.getJardin()); } } } }
void Awake() { myButton = GetComponent<Button>(); // <-- you get access to the button component here myButton.onClick.AddListener(VerifFormule); // <-- you assign a method to the button OnClick event here terrainHandler = (TerrainHandler)GameObject.Find("Plane").GetComponent<TerrainHandler>(); }
void Start() { terrainHandler = (TerrainHandler)GameObject.Find("Plane").GetComponent<TerrainHandler>(); }
void Start() { terrainHandler = (TerrainHandler)GameObject.Find("Plane").GetComponent <TerrainHandler>(); }
public void Initialize() { AllEnvironments = new Dictionary <string, Environment>(); AllLevels = new List <Level>(); CurrentLevel = new Level(); CurrentLevel.Name = GameManager.Inst.LevelName; AllLevels.Add(CurrentLevel); CurrentTerrain = GameObject.Find("Terrain").GetComponent <TerrainHandler>(); CurrentTerrain.Initialize(); CurrentTime = 60 * 17f; IsDayTime = true; NightDayTransition = 60 * 6 + UnityEngine.Random.Range(-1f, 1f) * 30; DayNightTransition = 60 * 20 + UnityEngine.Random.Range(-1f, 1f) * 30; Environment dayWild = new Environment("Wilderness"); GameManager.Inst.SoundManager.SetMusic(dayWild.Name, IsDayTime); dayWild.IsInterior = false; dayWild.AmbientLightColor = new Color(0.424f, 0.430f, 0.444f); dayWild.AmbientIntensity = 0.7f; dayWild.SunMoonColor = new Color(1, 0.984f, 0.918f, 1f); dayWild.SunMoonIntensity = 0.7f; dayWild.ShadowIntensity = 1; AllEnvironments.Add(dayWild.Name, dayWild); Environment cellar = new Environment("Cellar"); cellar.IsInterior = true; cellar.AmbientLightColor = new Color(0.1f, 0.1f, 0.1f); cellar.AmbientIntensity = 0.1f; cellar.SunMoonColor = new Color(0, 0, 0, 0); cellar.SunMoonIntensity = 0; cellar.ShadowIntensity = 1; AllEnvironments.Add(cellar.Name, cellar); Environment buildingInterior = new Environment("BuildingInteriorWood"); buildingInterior.IsInterior = true; buildingInterior.AmbientLightColor = new Color(0.3f, 0.3f, 0.3f); buildingInterior.AmbientIntensity = 0.3f; buildingInterior.SunMoonColor = new Color(0, 0, 0, 0); buildingInterior.SunMoonIntensity = 0; buildingInterior.ShadowIntensity = 1; AllEnvironments.Add(buildingInterior.Name, buildingInterior); CurrentEnvironment = dayWild; CurrentEnvironment.LoadEnvironment(); _nextAmbientTime = UnityEngine.Random.Range(3, 6); _ambientPlayCounter = 0; /* * //assign ID to all doors * GameObject [] doors = GameObject.FindGameObjectsWithTag("Door"); * foreach(GameObject o in doors) * { * Door door = o.GetComponent<Door>(); * if(door != null) * { * door.ID = CurrentLevelName + "Door" + _doorIDIndex; * _doorIDIndex ++; * } * } */ }