void Awake() { EH = GetComponent<EnemyHealth>(); stopDist = 1.5f; _canAttack = true; _motor = GetComponent<PlatformerMotor2D>(); _anim = GetComponent<EnemyAIAnimator>(); _hero = PlayerPrefs.GetInt("Hero"); AI = this.gameObject; //Determine which hero to look for and go after; switch (_hero) { case 0: Debug.Log("I am from Ionia"); target = GameObject.FindGameObjectWithTag("Ionian"); targetT = target.transform; IS = target.GetComponent<IonianStatistics>(); IH = target.GetComponent<IonianHealth>(); IXP = target.GetComponent<IonianEXP>(); _pMaster = target.GetComponent<PlayerMaster>(); break; case 1: Debug.Log("I am from Athens"); target = GameObject.FindGameObjectWithTag("Athenian"); targetT = target.transform; ATS = target.GetComponent<AthenianStatistics>(); ATH = target.GetComponent<AthenianHealth>(); ATXP = target.GetComponent<AthenianEXP>(); _pMaster = target.GetComponent<PlayerMaster>(); break; case 2: Debug.Log("I am from Sparta"); target = GameObject.FindGameObjectWithTag("Spartan"); targetT = target.transform; SS = target.GetComponent<SpartanStatistics>(); SH = target.GetComponent<SpartanHealth>(); SXP = target.GetComponent<SpartanEXP>(); _pMaster = target.GetComponent<PlayerMaster>(); break; case 3: Debug.Log("I am Greek"); target = GameObject.FindGameObjectWithTag("Achilles"); targetT = target.transform; AS = target.GetComponent<AchillesStatistics>(); AH = target.GetComponent<AchillesHealth>(); AXP = target.GetComponent<AchillesEXP>(); _pMaster = target.GetComponent<PlayerMaster>(); break; } }
// Use this for initialization void Start() { EAIM = GetComponent<EnemyAIMaster>(); _anim = GetComponent<EnemyAIAnimator>(); target = EAIM.target; _hero = EAIM._hero; InIt(); }