/*public void SetPlayer(GameObject player) * { * this.player=player; * }*/ public string GetScript(GameObject mob) { if (mob.GetComponent <IA_Skeleton_code>() != null) { Skeleton = mob.GetComponent <IA_Skeleton_code>(); return("Skeleton"); } if (mob.GetComponent <IA_Hob_Code>() != null) { Hob = mob.GetComponent <IA_Hob_Code>(); return("Hob"); } if (mob.GetComponent <IA_Albinos_code>() != null) { Dragon = mob.GetComponent <IA_Albinos_code>(); return("Dragon"); } if (mob.GetComponent <Skeleton_Dummie>() != null) { Dummie = mob.GetComponent <Skeleton_Dummie>(); return("Dummie"); } if (mob.GetComponent <Boss_IA>() != null) { Boss = mob.GetComponent <Boss_IA>(); return("Boss"); } return(null); }
void OnTriggerStay(Collider collision) { IA_Hob_Code script = holder.GetComponent <IA_Hob_Code>(); if (IsHiting && collision.gameObject == script.GetTarget()) { Debug.Log("hit"); script.ApplyDamage(collision.gameObject); IsHiting = false; } }
void Start() { Hob = gameObject.AddComponent <IA_Hob_Code>(); Hob.SetTarget(null); Hob.SetAnimator(animator); Hob.SetWeapon(Weapon); ((enemy_couroutine)Hob).SetAttackRange(2); ((enemy_couroutine)Hob).SetMoveSpeed(3); ((enemy_couroutine)Hob).SetAttackDelay(1); ((enemy_couroutine)Hob).SetAttackDammage(15); ((enemy_couroutine)Hob).SetHealth(100); Hob.StartCoroutine("CheckEntity"); }
void OnTriggerStay(Collider collision) { IA_Hob_Code script = holder.GetComponent <IA_Hob_Code>(); if (IsHiting && collision.gameObject == script.GetTarget()) { Debug.Log("hit"); if (Random.Range(0, 10) == 1) { collision.gameObject.GetComponent <UnarmedCharacter>().status = Status.Stunned; if (collision.gameObject.GetComponent <PlayerStat>().coroutine != null) { StopCoroutine(collision.gameObject.GetComponent <PlayerStat>().coroutine); } collision.gameObject.GetComponent <PlayerStat>().SetDOT_Time(2); collision.gameObject.GetComponent <PlayerStat>().coroutine = StartCoroutine(collision.gameObject.GetComponent <PlayerStat>().GetOverTime()); } script.ApplyDamage(collision.gameObject); IsHiting = false; } }
public string GetScript(GameObject mob) { try { Skeleton = mob.GetComponent <IA_Skeleton_code>(); return("Skeleton"); } catch (System.NullReferenceException) { try { Hob = mob.GetComponent <IA_Hob_Code>(); return("Hob"); } catch (System.NullReferenceException) { Dragon = mob.GetComponent <IA_Albinos_code>(); return("Dragon"); } } }
void Update() { IA_Hob_Code script = holder.GetComponent <IA_Hob_Code>(); IsHiting = script.Getanimator().GetCurrentAnimatorStateInfo(0).IsName("attack02"); }