public void SetLevel() { for (var i = 0; i < this.meshRenderers.Length; i++) { this.meshRenderers[i].SetEnable(false); } this.currentTowerRenderer = this.meshRenderers[this.building.CurrentLevel - 1]; this.currentTowerRenderer.SetEnable(true); }
private void Awake() { this.building = this.transform.root.GetComponentInChildren <IBuilding>(); this.buildingAttackSystem = this.transform.root.GetComponentInChildren <IBuildingAttackSystem>(); if (this.deployAreaRenderer != null) { this.deployAreaRenderer.transform.localScale = new Vector3(this.building.MapRect.width, this.building.MapRect.height, this.building.MapRect.height); } this.obstructRenderer.transform.localScale = new Vector3(this.building.MapRect.width, this.building.MapRect.height, this.building.MapRect.height); this.obstructRenderer.material.SetVector("_Scale", new Vector4(1 + (this.building.MapRect.width - 4) * 0.25f, 1 + (this.building.MapRect.height - 4) * 0.25f, 0f, 0f)); this.currentTowerRenderer = this.meshRenderers[0]; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { towerRenderer = new TowerRenderer(this); Components.Add(towerRenderer); camera = new QuakeCamera(this); Components.Add(camera); ddrawer = new DebugDrawer(this); Components.Add(ddrawer); var fpsCounter = new FrameRateCounter(this); Components.Add(fpsCounter); Components.Add(new DebugOutput(this)); player = new Player(new Vector3(0, maxPos, 0), camera as QuakeCamera); physics.AddController(player.PhysicsController); player.PhysicsController.EnableController(); base.Initialize(); }