private void Start() { GameUI = CastUIPresenter.CreateComponent(Camera.main, gameObject); CastCameraController.CreateComponent(Camera.main, GameUI.SelectedCreature, GameUI.FallbackedEventsObservable); GameUI.LeftToolBar.Add(new SystemActions()); Plane.transform.position = Vector3.zero; Plane.transform.localScale = Vector3.one * 100; var unitPlaneSize = 10; _size = new Rect( (Plane.transform.position.x - Plane.transform.lossyScale.x * unitPlaneSize) / 2, (Plane.transform.position.y - Plane.transform.lossyScale.y * unitPlaneSize) / 2, Plane.transform.lossyScale.x * unitPlaneSize, Plane.transform.lossyScale.y * unitPlaneSize ); StartCoroutine(Feeder()); foreach (var creaturePrefab in CreaturePrefabs) { for (var i = 0; i < CreatureCountPerPrefab; i++) { var pos = new Vector3( x: _size.xMin + Random.value * _size.width, y: 0, z: _size.yMin + Random.value * _size.height); var creatureRootGameObject = Instantiate(creaturePrefab, pos, Quaternion.identity); var creature = StartCreature(creatureRootGameObject, creatureRootGameObject.transform.GetChild(0).gameObject); creature.name = creaturePrefab.name.Substring(0, Mathf.Min(15, creaturePrefab.name.Length)); } } }
private void Start() { GameUI = CastUIPresenter.CreateComponent(Camera.main, gameObject); CastCameraController.CreateComponent(Camera.main, GameUI.SelectedCreature, GameUI.FallbackedEventsObservable); GameUI.LeftToolBar.Add(new SystemActions()); Plane.transform.position = Vector3.zero; Plane.transform.localScale = Vector3.one * 10; var unitPlaneSize = 10; _size = new Rect( (Plane.transform.position.x - Plane.transform.lossyScale.x * unitPlaneSize) / 2, (Plane.transform.position.y - Plane.transform.lossyScale.y * unitPlaneSize) / 2, Plane.transform.lossyScale.x * unitPlaneSize, Plane.transform.lossyScale.y * unitPlaneSize ); SpawnCreature(reinforcement: true); SpawnCreature(reinforcement: true); SpawnCreature(reinforcement: false); SpawnCreature(reinforcement: false); StartCoroutine(Feeder()); }
private void Start() { GameUI = CastUIPresenter.CreateComponent(Camera.main, gameObject); CastCameraController.CreateComponent(Camera.main, GameUI.SelectedCreature, GameUI.FallbackedEventsObservable); GameUI.LeftToolBar.Add(new SystemActions()); Plane.GetComponent <Renderer>().material = Resources.Load("Materials/Ground", typeof(Material)) as Material; Plane.transform.position = Vector3.zero; Plane.transform.localScale = Vector3.one * 100; var unitPlaneSize = 10; _size = new Rect( (Plane.transform.position.x - Plane.transform.lossyScale.x * unitPlaneSize) / 2, (Plane.transform.position.y - Plane.transform.lossyScale.y * unitPlaneSize) / 2, Plane.transform.lossyScale.x * unitPlaneSize, Plane.transform.lossyScale.y * unitPlaneSize ); var generator = new TreeJointGenerator(new[] { Resources.Load <GameObject>("Prefabs/CubeBody"), Resources.Load <GameObject>("Prefabs/CubeBody2"), Resources.Load <GameObject>("Prefabs/CylinderBody1"), Resources.Load <GameObject>("Prefabs/SphereBody1"), Resources.Load <GameObject>("Prefabs/CapsuleBody1") }, new[] { Resources.Load <GameObject>("Prefabs/CubeArm"), Resources.Load <GameObject>("Prefabs/CubeArm2") }); StartCoroutine(Feeder()); StartCoroutine(SpawnSome(generator)); }