void Awake() { agent = GetComponent <WaypointAgent>(); animator = GetComponentInChildren <Animator>(); photonView = GetComponent <PhotonView>(); enemyHUD = GetComponentInChildren <EnemyHUD>(); agent.MoveSpeed = Speed; if (DamageType == DamageType.Shared) { healthStat = new SharedHealthStat(MaxHP); } else { healthStat = new UniqueHealthStat(MaxHP, 2); } }
private void Start() { cam = HunterGameMode.Instance.LocalHunterPlayer.PlayerCamera; owner = GetComponentInParent <Enemy>(); healthStat = owner.GetStat(); foreach (var h in healthWidgets) { h.gameObject.SetActive(false); } HealthCellQueue = new Queue <HealthCellWidget>(); if (owner.DamageType == DamageType.Shared) { SharedHealthStat stat = (SharedHealthStat)healthStat; for (int i = 0; i < stat.MaxValue; i++) { var healthWidget = healthWidgets[i]; healthWidget.gameObject.SetActive(true); healthWidget.Init(-1); HealthCellQueue.Enqueue(healthWidget); } } else { UniqueHealthStat stat = (UniqueHealthStat)healthStat; foreach (var i in stat.Values) { var healthWidget = healthWidgets[i]; healthWidget.gameObject.SetActive(true); healthWidget.Init(i); HealthCellQueue.Enqueue(healthWidget); } } }