public bool CheckBossParry() { BossStates ParryTarget = null; Vector3 Orgin = transform.position; Orgin.y += 1; Vector3 RayDir = transform.forward; RaycastHit hit; if (Physics.Raycast(Orgin, RayDir, out hit, 3f, IgnoreLayers)) { ParryTarget = hit.transform.GetComponentInParent <BossStates>(); } if (ParryTarget == null) { return(false); } Vector3 dir = ParryTarget.transform.position - transform.position; dir.Normalize(); dir.y = 0; float _angle = Vector3.Angle(transform.forward, dir); if (_angle < 60) { Vector3 targetPos = -dir * ParryOffset; targetPos += ParryTarget.transform.position; transform.position = targetPos; if (dir == Vector3.zero) { dir = -ParryTarget.transform.forward; } Quaternion ERotation = Quaternion.LookRotation(-dir); Quaternion ourRot = Quaternion.LookRotation(dir); ParryTarget.transform.rotation = ERotation; transform.rotation = ourRot; ParryTarget.IsGettingParried(); CanMove = false; InAction = true; ParryIsOn = false; EnemyTarget = null; return(true); } return(false); }
private void Start() { EnemyPos = this.transform.position; if (States == null) { States = GetComponent <BossStates>(); } States.Start(); }
private void OnTriggerEnter(Collider other) { BossStates States = other.transform.GetComponent <BossStates>(); if (States == null) { return; } States.DoDamage(BossDamageRate); }
public void OnTriggerEnter(Collider other) { if (states) { EnemyStates e_st = other.transform.GetComponentInParent <EnemyStates>(); if (e_st == null) { e_st.CheckForParry(transform.root, states); } } if (Bstates) { BossStates st = other.transform.GetComponent <BossStates>(); if (st == null) { Debug.Log("Parry"); st.CheckForParry(transform.root, states); } } }
public void InitBoss(BossStates Bst) { Bstates = Bst; }