// Use this for initialization void Awake() { estructure = (GameObject)Instantiate(estructure, transform.position, Quaternion.identity); estructure.transform.parent = this.transform; estructure.transform.rotation = this.transform.rotation; characterModel = (GameObject)Instantiate(characterModel, new Vector3(transform.position.x,transform.position.y + towerHeight,transform.position.z), Quaternion.identity); characterModel.transform.parent = estructure.transform; characterModel.transform.rotation = this.transform.rotation; characterScript = (Character)characterModel.AddComponent(job.ToString()); aim = characterModel.AddComponent<AimController> (); characterScript.aim = aim; aim.SetCharacter (characterScript); button = characterModel.AddComponent<ButtonTower> (); button.SetCharacter (characterScript); characterScript.SetButton (button); }
public void SetButton(ButtonTower button) { this.button = button; }