// Start is called before the first frame update void Start() { healthSystem = new HealthSystem(100); healthTransform = Instantiate(healthbarPf, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y + 1.6f), Quaternion.identity); Healthbar healthbar = healthTransform.GetComponent <Healthbar>(); healthbar.Setup(healthSystem); }
// Start is called before the first frame update void Start() { pendulumArm = gameObject.transform.GetChild(1).gameObject; pendulumArm.SetActive(false); scoring = GameObject.Find("ScoreManager").GetComponent <ScoreManager>(); healthSystem = new HealthSystem(100); body2d = GetComponent <Rigidbody2D>(); healthTransform = Instantiate(healthbarPf, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y + 1.2f), Quaternion.identity); Healthbar healthbar = healthTransform.GetComponent <Healthbar>(); healthbar.Setup(healthSystem); }
void Spawn() { //int spawnPointIndex = Random.Range(0, spawnPoints.Length); for (int i = 0; i < 3 + extraSpawns; i++) { GameObject obj = PhotonNetwork.InstantiateSceneObject(prefab, spawnPoints[i].position, spawnPoints[i].rotation); obj.GetComponent <UnitCreepController>().destination = transform.position + transform.forward * 90; Healthbar creep = obj.GetComponent <Healthbar>(); if (creep != null) { creep.Setup(hb.side); } } }