-
Notifications
You must be signed in to change notification settings - Fork 0
/
BuildingBehavior.cs
42 lines (33 loc) · 952 Bytes
/
BuildingBehavior.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class BuildingBehavior : MonoBehaviour {
public Building building { get; private set; }
[SerializeField]
Building.BuildingType buildingType;
Resource resource;
[SerializeField]
public int extendsX = 2;
[SerializeField]
public int extendsZ = 2;
[SerializeField]
public List<Vector2> entrances;
int id;
void Awake(){
this.resource = GameObject.FindGameObjectWithTag ("ResourceManager").GetComponent<ResourceBehavior> ().resource;
this.building = new Building (buildingType);
resource.addBuilding (building);
resource.gameObjects.Add (this.GetInstanceID(), this.building);
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
resource.updateMenus ();
building.Update();
}
public Building.BuildingType getType(){
return buildingType;
}
}