Exemplo n.º 1
0
        void OnTriggerEnter(Collider other)
        {
            EnemyStates enemyStates = other.transform.GetComponentInParent <EnemyStates>();

            if (!enemyStates)
            {
                return;
            }

            enemyStates.DoDamage(35);
        }
Exemplo n.º 2
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.GetComponentInParent <EnemyStates>();
            }

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

            // direction calculated from the enemy to the player.
            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.GetCurrentWeapon(slot.mirror));
                canAttack = false;
                onEmpty   = false;
                canMove   = false;
                inAction  = true;
                anim.SetBool("mirror", slot.mirror);
                anim.CrossFade("parry_attack", 0.2f);
                lockOnTarget = null;

                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        private void OnTriggerEnter(Collider other)
        {
            EnemyStates eStates = other.transform.GetComponentInChildren <EnemyStates>();

            if (eStates == null)
            {
                return;
            }
            else
            {
                eStates.DoDamage(EnemyDamage);
            }
        }
Exemplo n.º 4
0
        void OnTriggerEnter(Collider other)
        {
            DamageCollider dc = other.GetComponentInChildren <DamageCollider>();

            if (dc != null)
            {
                EnemyStates eStates = dc.GetComponentInParent <EnemyStates>();
                if (eStates != null)
                {
                    eStates.HandleBlocked();
                }
            }
        }
Exemplo n.º 5
0
 public void Init(EnemyStates eSt)
 {
     eStates = eSt;
     anim    = eStates.anim;
     if (anim.isHuman == false)
     {
         return;
     }
     for (int i = 0; i < humanoidBones.Count; i++)
     {
         targets.Add(anim.GetBoneTransform(humanoidBones[i]));
     }
 }
        private void OnTriggerEnter(Collider other)
        {
            EnemyStates eStates = other.transform.GetComponentInParent <EnemyStates>();

            if (eStates == null)
            {
                return;
            }
            if (other.isTrigger == false)
            {
                eStates.DoDamage(35);
            }
        }
Exemplo n.º 7
0
        public void Init(EnemyStates enemyStates)
        {
            this.enemyStates = enemyStates;
            animator         = enemyStates.animator;
            if (!animator.isHuman)
            {
                return;
            }

            for (int i = 0; i < humanoidBones.Count; i++)
            {
                targets.Add(animator.GetBoneTransform(humanoidBones[i]));
            }
        }
Exemplo n.º 8
0
        public bool CheckForBackStab()
        {
            EnemyStates BackStab = null;

            Vector3 Orgin = transform.position;

            Orgin.y += 1;
            Vector3    RayDir = transform.forward;
            RaycastHit hit;

            if (Physics.Raycast(Orgin, RayDir, out hit, 1f, 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 targetPos = dir * BackStabOffset;
                targetPos         += BackStab.transform.position;
                transform.position = targetPos;

                Anim.Play("Stab");
                BackStab.transform.rotation = transform.rotation;
                BackStab.IsGettingBackStab();

                CanMove  = false;
                InAction = true;

                // Need to change this shit..
                ParryIsOn = false;

                EnemyTarget = null;
                return(true);
            }

            return(false);
        }
        bool CheckForBackstab(Action slot)
        {
            if (!slot.canBackstab)
            {
                return(false);
            }

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

            origin.y += 1f;
            Vector3 rayDir = transform.forward;

            RaycastHit hit;

            if (Physics.Raycast(origin, rayDir, out hit, 1f, 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 > 150f)
            {
                Vector3 targetPosition = dir * backstabOffset;
                targetPosition    += backstab.transform.position;
                transform.position = targetPosition;

                backstab.transform.rotation = transform.rotation;
                backstab.IsGettingBackstabbed(slot);

                canMove  = false;
                inAction = true;
                anim.SetBool(StaticStrings.mirror, slot.mirror);
                anim.CrossFade(StaticStrings.parry_attack, .2f);
                lockOnTarget = null;
                return(true);
            }

            return(false);
        }
Exemplo n.º 10
0
        void OnTriggerEnter(Collider other)
        {
            EnemyStates eStates = other.GetComponentInParent <EnemyStates>();

            if (eStates != null)
            {
                eStates.DoDamageSpell();
                SpellEffectsManager.singleton.UseSpellEffect("onFire", null, eStates);
            }

            GameObject g0 = Instantiate(explosionPrefab, transform.position, transform.rotation) as GameObject;

            Destroy(this.gameObject);
        }
Exemplo n.º 11
0
        public void Init(EnemyStates eSt)
        {
            enStates = eSt;
            anim     = enStates.anim;

            if (!anim.isHuman)
            {
                return;
            }

            for (int i = 0; i < humanoidBones.Count; i++)
            {
                targets.Add(anim.GetBoneTransform(humanoidBones [i]));
            }

            EnemyManager.singleton.enemyTargets.Add(this);
        }
Exemplo n.º 12
0
        //-----------------------------------------------------------------------

        public void Init(EnemyStates st)
        {
            eStates = st;
            anim    = eStates.anim;
            if (anim.isHuman == false)
            {
                return;
            }

            // populate the targets[];
            for (int i = 0; i < h_bones.Count; i++)
            {
                targets.Add(anim.GetBoneTransform(h_bones[i]));
            }

            EnemyManager.singleton.enemyTargets.Add(this);
        }
 public void Init(StateManager sm, EnemyStates est)
 {
     states  = sm;
     eStates = est;
     if (states != null)
     {
         anim       = sm.anim;
         rigid      = sm.body;
         delta      = sm.delta;
         roll_curve = sm.rollCurve;
     }
     if (eStates != null)
     {
         anim  = est.anim;
         rigid = est.body;
         delta = est.delta;
     }
 }
Exemplo n.º 14
0
 public void Init(StateManager st, EnemyStates eSt)
 {
     states = st;
     if (states != null)
     {
         anim       = st.anim;
         rigid      = st.rigid;
         roll_curve = st.roll_curve;
         delta      = st.delta;
     }
     enStates = eSt;
     if (enStates != null)
     {
         anim  = eSt.anim;
         rigid = eSt.rigid;
         delta = eSt.delta;
     }
 }
Exemplo n.º 15
0
        public void Init(StateManager stateManager, EnemyStates enemyStates)
        {
            this.stateManager = stateManager;
            this.enemyStates  = enemyStates;
            if (stateManager != null)
            {
                animator  = stateManager.animator;
                rigidBody = stateManager.rigidBody;
                rollCurve = stateManager.rollCurve;
                delta     = stateManager.delta;
            }

            if (enemyStates != null)
            {
                animator  = enemyStates.animator;
                rigidBody = enemyStates.rigidBody;
                delta     = enemyStates.delta;
            }
        }
Exemplo n.º 16
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 player
            }
        }
Exemplo n.º 17
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);
                }
            }
        }
Exemplo n.º 18
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, 2, ignoreLayers))
            {
                parryTarget = hit.transform.GetComponentInParent <EnemyStates>();
            }

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

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

            //direction calculated from the player to the enemy.
            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.GetCurrentWeapon(slot.mirror));
                canAttack = false;
                onEmpty   = false;
                canMove   = false;
                inAction  = true;
                anim.SetBool("mirror", slot.mirror);
                anim.SetFloat("parrySpeed", 1);
                anim.CrossFade("parry_attack", 0.2f);
                lockOnTarget = null;


                return(true);
            }

            return(false);
        }
Exemplo n.º 19
0
 public void InitEnemy(EnemyStates st)
 {
     eStates          = st;
     gameObject.layer = 9;
     gameObject.SetActive(false);
 }
Exemplo n.º 20
0
 public void InitEnemy(EnemyStates eSt)
 {
     eStates = eSt;
 }
Exemplo n.º 21
0
        public bool CheckForParry()
        {
            EnemyStates 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 <EnemyStates>();
            }

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

            /*  if(ParryTarget.ParriedBY == null)
             *    return false;*/


            /*    float distnace = Vector3.Distance(ParryTarget.transform.position,transform.position);
             *  if(distnace > 3f)
             *
             *      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();

                Anim.CrossFade("Parry", 0.01f);
                CanMove     = false;
                InAction    = true;
                ParryIsOn   = false;
                EnemyTarget = null;


                return(true);
            }

            return(false);
        }
Exemplo n.º 22
0
        bool CheckForParry(Action slot)
        {
            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.GetComponentInParent <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();
                canMove  = false;
                inAction = true;
                anim.SetBool(StaticStrings.mirror, slot.mirror);
                anim.CrossFade(StaticStrings.parry_attack, 0.2f);
                lockOnTarget = null;
                return(true);
            }

            return(false);
        }
 public void InitEnemy(EnemyStates est)
 {
     enStates = est;
 }
Exemplo n.º 24
0
 public void Initenemy(EnemyStates Est)
 {
     Estates = Est;
 }