// Use this for initialization void Start() { loadMarker = transform.Find ("LoadMarker").GetComponent<LoadMarker>(); loadMarker.road = this; roads.Add (this); // transform.eulerAngles = new Vector3( // 1, // transform.eulerAngles.y, // transform.eulerAngles.z); if(GameController.gameStarted){ foreach(Transform child in transform.Find ("Spawns")){ float randomValue = Random.value; if(randomValue <= hazardChance){ GameObject rock = Instantiate(Resources.Load ("Rock"), SpawnPosition (child.transform.position), Quaternion.identity) as GameObject; rock.transform.localScale = rock.transform.localScale * .1f; }else if(randomValue <= hazardChance + neutralChance){ GameObject neutralContainer = Instantiate(Resources.Load ("Minions/Neutral Container"), SpawnPosition (child.transform.position), Quaternion.identity) as GameObject; Transform neutralBody = neutralContainer.transform.Find("Ship").transform; neutralBody.GetComponent<Entity>().neutral = true; OrientationHelper.RotateTransform(neutralBody.transform, -90); } } } }
public override void _Ready() { GD.Print(ConfigManager.BASE_CONFIG_FILE_DIRECTORY_PATH); GD.Print(ConfigManager.BASE_DIRECTORY); GD.Print(ConfigManager.BASE_CONFIG_FILE_PATH); VisualServer.SetDebugGenerateWireframes(true); gameController = (GameController)FindParent("GameController"); ray = (RayCast)gameController.FindNode("Picker"); camera = (Camera)FindNode("Camera"); fps = (Label)camera.FindNode("FPS"); position = (Label)camera.FindNode("Position"); chunks = (Label)camera.FindNode("Chunks"); vertices = (Label)camera.FindNode("Vertices"); memory = (Label)camera.FindNode("Memory"); speed = (Label)camera.FindNode("Movement Speed"); initialRotation = new Vector3(); picker = gameController.GetPicker(); Input.SetMouseMode(Input.MouseMode.Captured); TerraVector3 origin = Converter.ConvertVector(GlobalTransform.origin); TerraBasis basis = Converter.ConvertBasis(GlobalTransform.basis); marker = new LoadMarker(origin, basis); gameController.Prepare(camera, marker); }
// Use this for initialization void Start() { loadMarker = transform.Find("LoadMarker").GetComponent <LoadMarker>(); loadMarker.road = this; roads.Add(this); // transform.eulerAngles = new Vector3( // 1, // transform.eulerAngles.y, // transform.eulerAngles.z); if (GameController.gameStarted) { foreach (Transform child in transform.Find("Spawns")) { float randomValue = Random.value; if (randomValue <= hazardChance) { GameObject rock = Instantiate(Resources.Load("Rock"), SpawnPosition(child.transform.position), Quaternion.identity) as GameObject; rock.transform.localScale = rock.transform.localScale * .1f; } else if (randomValue <= hazardChance + neutralChance) { GameObject neutralContainer = Instantiate(Resources.Load("Minions/Neutral Container"), SpawnPosition(child.transform.position), Quaternion.identity) as GameObject; Transform neutralBody = neutralContainer.transform.Find("Ship").transform; neutralBody.GetComponent <Entity>().neutral = true; OrientationHelper.RotateTransform(neutralBody.transform, -90); } } } }
public void AddLoadMarker(LoadMarker loadMarker) { if (this.loadMarker == null) { this.loadMarker = loadMarker; Release(); } }
// Use this for initialization void Start() { loadMarker = transform.Find ("LoadMarker").GetComponent<LoadMarker>(); loadMarker.road = this; SpawnObstacles(); SpawnFoods(); SpawnTreasure(); SpawnBaddies(); }
public void Prepare(Camera camera, LoadMarker marker) { registry = new Registry(); PrimitiveResources.Register(registry); weltschmerz = new Weltschmerz(); Config config = weltschmerz.GetConfig(); config.elevation.max_elevation = MAX_ELEVATION; config.elevation.min_elevation = MIN_ELEVATION; config.map.latitude = LATITUDE; config.map.longitude = LONGITUDE; mesher = (GodotMesher)FindNode("GameMesher"); mesher.SetRegistry(registry); if (LONGITUDE < 2) { LONGITUDE = 2; } if (LATITUDE < 2) { LATITUDE = 2; } if (MAX_ELEVATION < 2) { MAX_ELEVATION = 2; } GD.Print("Using " + GENERATION_THREADS + " threads"); Position boundries = new Position(); boundries.x = LONGITUDE; boundries.y = MAX_ELEVATION; boundries.z = LATITUDE; terra = new Terra(boundries, this); picker = new Picker(terra, mesher); GodotSemaphore semaphore1 = new GodotSemaphore(); GodotSemaphore semaphore2 = new GodotSemaphore(); foreman = new Foreman(weltschmerz, terra, registry, mesher, VIEW_DISTANCE, camera.Fov, GENERATION_THREADS, semaphore1, semaphore2); for (int t = 0; t < GENERATION_THREADS; t++) { Thread thread = new Thread(); thread.Start(this, nameof(Generation)); } for (int t = 0; t < PROCESS_THREADS; t++) { Thread thread = new Thread(); thread.Start(this, nameof(Loading)); } foreman.SetMaterials(registry); marker.Attach(foreman); foreman.AddLoadMarker(marker); }