예제 #1
0
        void OnTriggerEnter(Collider other)
        {
            EnemyStates eStates = other.transform.GetComponentInParent <EnemyStates>();

            if (eStates == null)
            {
                return;
            }

            eStates.DoDamage(states.currentAction, states.inventoryManager.GetCurrrentWeapon(states.currentAction.mirror));
        }
예제 #2
0
        void OnFire(StateManager c, EnemyStates e)
        {
            if (c != null)
            {
            }

            if (e != null)
            {
                e.spellEffect_loop = e.OnFire;
            }
        }
예제 #3
0
        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, 1, ignoreLayers))
            {
                backstab = hit.transform.GetComponent <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 * backStabOffset;
                targetPosition    += backstab.transform.position;
                transform.position = targetPosition;

                backstab.transform.rotation = transform.rotation;
                backstab.IsGettingBackstabbed(slot, inventoryManager.GetCurrrentWeapon(slot.mirror));

                onEmpty   = false;
                canMove   = false;
                canAttack = false;
                inAction  = true;
                anim.SetBool(StaticStrings.mirror, slot.mirror);
                anim.CrossFade(StaticStrings.parry_attack, 0.2f);
                lockonTarget = null;
                return(true);
            }

            return(false);
        }
예제 #4
0
        void OnTriggerEnter(Collider other)
        {
            EnemyStates es = other.GetComponentInParent <EnemyStates>();

            if (es != null)
            {
                es.health -= 40;
                es.DoDamage_();
                SpellEffectManager.singleton.UseSpellEffect("onFire", null, es);
            }
            GameObject go = Instantiate(explosionPrefab, transform.position, transform.rotation) as GameObject;

            Destroy(this.gameObject);
        }
예제 #5
0
        public void Init(EnemyStates st)
        {
            eState = st;
            anim   = eState.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);
        }
예제 #6
0
        void OnTriggerEnter(Collider other)
        {
            //DamageCollider dc = other.GetComponent<DamageCollider>();
            //if (dc == null)
            //    return;

            if (states)
            {
                EnemyStates e_st = other.transform.GetComponentInParent <EnemyStates>();

                if (e_st != null)
                {
                    e_st.CheckForParry(transform.root, states);
                }
            }

            if (eStates)
            {
                //check for palyer
            }
        }
예제 #7
0
        public void Init(StateManager st, EnemyStates eSt)
        {
            states  = st;
            eStates = eSt;
            if (st != null)
            {
                anim       = st.anim;
                rigid      = st.rigid;
                roll_curve = states.roll_curve;
                delta      = st.delta;
            }
            if (eSt != null)
            {
                anim  = eSt.anim;
                rigid = eSt.rigid;
                delta = eSt.delta;
            }

            ik_handler = gameObject.GetComponent <HandleIK>();
            if (ik_handler != null)
            {
                ik_handler.Init(anim);
            }
        }
예제 #8
0
 public void InitEnemy(EnemyStates st)
 {
     eStates = st;
 }
예제 #9
0
        bool CheckForParry(Action slot)
        {
            if (slot.canParry == false)
            {
                return(false);
            }

            EnemyStates parryTarget = null;
            Vector3     origin      = transform.position;

            origin.y += 1;
            Vector3    rayDir = transform.forward;
            RaycastHit hit;

            if (Physics.Raycast(origin, rayDir, out hit, 3, ignoreLayers))
            {
                parryTarget = hit.transform.GetComponent <EnemyStates>();
            }

            if (parryTarget == null)
            {
                return(false);
            }

            if (parryTarget.parriedBy == null)
            {
                return(false);
            }

            //float dis = Vector3.Distance(parryTarget.transform.position, transform.position);

            //if (dis > 3)
            //    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 targetPosition = -dir * parryOffset;
                targetPosition    += parryTarget.transform.position;
                transform.position = targetPosition;

                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(slot, inventoryManager.GetCurrrentWeapon(slot.mirror));

                onEmpty   = false;
                canMove   = false;
                canAttack = false;
                inAction  = true;
                anim.SetBool(StaticStrings.mirror, slot.mirror);
                anim.Play(StaticStrings.parry_attack);
                lockonTarget = null;
                return(true);
            }
            return(false);
        }