void Start() { Arrow = GameObject.Find("arrow").gameObject; ArrowOriginalRotation = Arrow.transform.rotation; killColliderScript = GetComponent<KillCollider>(); }
// Create map Tiles private void drawMap() { this.tileGameObjects = new Dictionary <KeyValuePair <int, int>, GameObject>(); if (this.mapModel != null) { // Create tiles for (int y = 0; y < this.mapModel.Height; y++) { for (int x = 0; x < this.mapModel.Width; x++) { Map.MapTileType type = this.mapModel.getTileType(x, y); this.tileGameObjects.Add(new KeyValuePair <int, int>(y, x), this.createMapTile(type, x, y)); } } // Create Player this.createPlayer(0); // Create Bridges foreach (BridgeElement bridge in this.mapModel.Bridges) { this.createBridge(bridge); } foreach (BridgeButton button in this.mapModel.BridgeButtons) { this.createBridgeButton(button); } // Create Collectibles foreach (CollectibleElement collectible in this.mapModel.Collectibles) { this.createCollectible(collectible); } // Create Target this.createTarget(this.mapModel.PlayerTarget); // Create Blocks foreach (BlockElement block in this.mapModel.Blocks) { this.createBlock(block); } // Adjust the camera Camera mapCamera = GameObject.FindObjectOfType <Camera>(); if (mapCamera != null) { mapCamera.GetComponent <TrackingCamera> ().Target = this.gameObject.transform; mapCamera.transform.position = new Vector3(0, this.mapModel.Height + 1, 0); // 0.5 is the size of a half of the tile //mapCamera.transform.position = new Vector3( this.mapModel.Width/2f-0.5f, this.mapModel.Height/2f-0.5f, -1 ); // 0.5 is the size of a half of the tile //mapCamera.orthographicSize = Mathf.Max( this.mapModel.Width/2f, this.mapModel.Height/2f ); } // Adjust Kill Collider KillCollider killCollider = GetComponentInChildren <KillCollider>(); if (killCollider != null) { killCollider.setScale(this.mapModel.Width, this.mapModel.Height); killCollider.setMinHeight(0f); } // Adjust Floor /*if(floor != null){ * floor.transform.localScale = new Vector3 ( this.mapModel.Width-(useThinWall?0.9f:0f), 0.2f, this.mapModel.Height-(useThinWall?0.9f:0f)); * floor.transform.position = new Vector3 ( 0, -0.1f, 0 ); * }*/ } }
void Start() { Arrow = GameObject.Find("arrow").gameObject; ArrowOriginalRotation = Arrow.transform.rotation; killColliderScript = GetComponent <KillCollider>(); }