public void OnTriggerEnter(Collider other) { EnemyStates es = other.GetComponentInParent <EnemyStates>(); if (es != null) { es.health -= 10; es.DoDamage_(); } GameObject go = Instantiate(explosionPrefab, transform.position, transform.rotation) as GameObject; Destroy(this.gameObject); }
public void Init(EnemyStates st) { eState = st; anim = st.anim; if (anim.isHuman == false) { return; } for (int i = 0; i < h_bones.Count; i++) { targets.Add(anim.GetBoneTransform(h_bones[i])); } EnemyManager.singleton.enemyTargets.Add(this); }
bool CheckForBackstab(Action slot) { if (slot.canBackstab == false) { return(false); } EnemyStates backstab = null; Vector3 origin = transform.position; origin.y += 1; Vector3 rayDir = transform.forward; RaycastHit hit; if (Physics.Raycast(origin, rayDir, out hit, 3, ignoreLayers)) { backstab = hit.transform.GetComponentInParent <EnemyStates>(); } if (backstab == null) { return(false); } Vector3 dir = transform.position - backstab.transform.position; dir.Normalize(); dir.y = 0; float angle = Vector3.Angle(backstab.transform.forward, dir); if (angle > 150) { Vector3 targetPosition = dir * parriedOffset; targetPosition += backstab.transform.position; transform.position = targetPosition; backstab.transform.rotation = transform.rotation; backstab.IsGettingBackstabed(slot); canMove = false; inAction = true; anim.SetBool(StaticStrings.mirror, slot.mirror); anim.CrossFade(StaticStrings.parry_attack, 0.2f); //lockOnTarget = null; return(true); } return(false); }
void OnTriggerEnter(Collider other) { if (states) { EnemyStates e_st = other.GetComponentInParent <EnemyStates>(); if (e_st != null) { e_st.CheckForParry(transform.root, states); } } if (eStates) { //check for player } }
public void Init(StateManager st, EnemyStates eSt) { states = st; eStates = eSt; if (st != null) { anim = st.anim; rigid = st.rigid; rollCurve = st.roll_curve; delta = st.delta; } if (eSt != null) { anim = eSt.anim; rigid = eSt.rigid; delta = eSt.delta; } }
public void InitEnemy(EnemyStates st) { eStates = st; }