Example #1
0
        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);
        }
Example #2
0
 private void Start()
 {
     EnemyPos = this.transform.position;
     if (States == null)
     {
         States = GetComponent <BossStates>();
     }
     States.Start();
 }
Example #3
0
        private void OnTriggerEnter(Collider other)
        {
            BossStates States = other.transform.GetComponent <BossStates>();

            if (States == null)
            {
                return;
            }

            States.DoDamage(BossDamageRate);
        }
Example #4
0
        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);
                }
            }
        }
Example #5
0
 public void InitBoss(BossStates Bst)
 {
     Bstates = Bst;
 }