Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 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, 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);
        }
Esempio n. 4
0
        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
            }
        }
Esempio n. 5
0
 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;
     }
 }
Esempio n. 6
0
 public void InitEnemy(EnemyStates st)
 {
     eStates = st;
 }