예제 #1
0
        public override IEnumerator Action(ActorProxy actorProxy, ActorProxy targetActorProxy)
        {
#if UNITY_EDITOR
            if (targetActorProxy != null)
            {
                Debug.DrawLine(actorProxy.transform.position + Vector3.up * 0.2f, targetActorProxy.transform.position, Color.red, 2f);
            }
#endif
            var minionRush = actorProxy.baseEntity as Minion_Rush;
            minionRush.ps_Rush.Play();

            actorProxy.PlayAnimationWithRelay(AnimationHash.SkillLoop, null);

            var   ts   = actorProxy.transform;
            float tick = 0.1f;
            while (targetActorProxy != null && targetActorProxy.baseEntity != null)
            {
                ts.LookAt(targetActorProxy.transform);
                ts.position += (targetActorProxy.transform.position - ts.position).normalized * (minionRush.moveSpeed * 2.5f) * Time.deltaTime;

                if (tick < 0)
                {
                    tick = 0.1f;

                    var hits = Physics.RaycastAll(ts.position + Vector3.up * 0.1f, ts.forward, minionRush.range, minionRush.targetLayer);
                    foreach (var raycastHit in hits)
                    {
                        var bs = raycastHit.collider.GetComponentInChildren <BaseEntity>();
                        if (bs != null && bs.isAlive)
                        {
                            if (actorProxy.isPlayingAI)
                            {
                                bs.ActorProxy.HitDamage(minionRush.effect);
                            }

                            PoolManager.Get().ActivateObject("Effect_Stone", raycastHit.point);
                        }
                    }
                }

                if (Vector3.Distance(targetActorProxy.transform.position, ts.position) <= minionRush.range)
                {
                    break;
                }

                tick -= Time.deltaTime;
                yield return(null);
            }

            minionRush.ps_Rush.Stop();

            actorProxy.PlayAnimationWithRelay(AnimationHash.Idle, null);
        }
예제 #2
0
        protected IEnumerator AttackCoroutine(float attackSpeed)
        {
            _attackedTarget = target;
            ActorProxy.PlayAnimationWithRelay(AnimationHash.Attack, target);

            var tr  = ActorProxy.transform;
            var pos = tr.position;

            pos.y       = 0;
            tr.position = pos;
            pos         = target.transform.position;
            pos.y       = 0;
            tr.LookAt(pos);

            float t = 0;

            while (t < attackSpeed)
            {
                t += Time.deltaTime;
                yield return(null);

                //TODO: 히스토리: 공격모션 시작과 동시에 대상이 죽을 경우 허공에 칼질하는 문제를 피하려고 삽입된 코드. 동기화가 애매해 주석 처리함, 복구 방법 고려해볼 것. by Kwazii
                // if (target == null || target.isAlive == false)
                // {
                //     animator.SetTrigger(AnimationHash.Idle);
                //     yield break;
                // }
            }

            if (_attackedTarget != null && _attackedTarget.isAlive == false)
            {
                _attackedTarget = null;
            }
        }
예제 #3
0
        public override IEnumerator Attack()
        {
            if (ActorProxy.isPlayingAI)
            {
                ActorProxy.PlayAnimationWithRelay(AnimationHash.AttackReady, target);
            }

            //yield return new WaitForSeconds(0.5f);
            var aimingAction = new SniperAimingAction();

            RunningAction = aimingAction;
            yield return(aimingAction.ActionWithSync(ActorProxy, target.ActorProxy));

            RunningAction = null;

            if (ActorProxy.isPlayingAI)
            {
                if (IsCanAiming())
                {
                    ActorProxy.PlayAnimationWithRelay(AnimationHash.Attack, target);
                    yield return(new WaitForSeconds(0.5f));
                }
                else
                {
                    ActorProxy.PlayAnimationWithRelay(AnimationHash.Idle, target);
                }
            }
        }
예제 #4
0
    public override IEnumerator Attack()
    {
        ActorProxy.PlayAnimationWithRelay(AnimationHash.Attack, target);

        yield return(new WaitForSeconds(2f));

        ActorProxy.FireBulletWithRelay(E_BulletType.VALLISTA_SPEAR, target, power, 12f);
    }
예제 #5
0
        public override IEnumerator Attack()
        {
            _attackedTarget = target;
            var aniHash = target.isFlying ? AnimationHash.Attack2 : AnimationHash.Attack1;

            ActorProxy.PlayAnimationWithRelay(aniHash, target);

            yield return(AttackCoroutine(attackSpeed));
        }
예제 #6
0
    IEnumerator SkillCoroutine()
    {
        ActorProxy.PlayAnimationWithRelay(AnimationHash.Skill, target);

        yield return(new WaitForSeconds(0.8f));

        ActorProxy.AddBuff(BuffInfos.Invincibility, 2f);

        yield return(new WaitForSeconds(0.2f));
    }
예제 #7
0
        IEnumerator SummonCoroutine()
        {
            ActorProxy.PlayAnimationWithRelay(AnimationHash.Skill, null);

            yield return(new WaitForSeconds(0.4f));

            if (ActorProxy.isPlayingAI)
            {
                var positions = arrSpawnPos.Select(t => t.position).ToArray();
                ActorProxy.CreateActorBy(3012, ActorProxy.ingameUpgradeLevel, ActorProxy.outgameUpgradeLevel,
                                         positions);
            }

            for (int i = 0; i < arrSpawnPos.Length; i++)
            {
                arrPs_Spawn[i].Play();
            }

            yield return(new WaitForSeconds(0.3f));
        }
예제 #8
0
    IEnumerator SkillCoroutine()
    {
        var cols = Physics.OverlapSphere(transform.position, 2f, targetLayer);

        if (cols.Length <= 0)
        {
            yield break;
        }

        ActorProxy.PlayAnimationWithRelay(AnimationHash.Skill, target);

        yield return(new WaitForSeconds(0.75f));

        foreach (var col in cols)
        {
            var minion = col.GetComponentInParent <Minion>();
            if (minion != null)
            {
                minion.ActorProxy?.HitDamage(effect);
            }
        }

        yield return(new WaitForSeconds(0.25f));
    }
예제 #9
0
        public override IEnumerator Attack()
        {
            if (target == null || _spawnedTime < healTime + effectCooltime)
            {
                yield break;
            }

            var pos = transform.position;

            pos.y = 0.1f;

            var cols = Physics.OverlapSphere(pos, range, friendlyLayer);

            if (cols.Length > 0)
            {
                ActorProxy.PlayAnimationWithRelay(AnimationHash.Skill, target);

                if (ActorProxy.isPlayingAI)
                {
                    foreach (var col in cols)
                    {
                        if (col != null && col.CompareTag("Minion_Ground") && col.gameObject != gameObject)
                        {
                            var minion = col.GetComponentInParent <Minion>();
                            if (minion != null)
                            {
                                minion.ActorProxy.Heal(effect);
                            }
                        }
                    }
                }
                healTime = _spawnedTime;

                yield return(new WaitForSeconds(attackSpeed));
            }
        }
예제 #10
0
        public override IEnumerator Action(ActorProxy actorProxy, ActorProxy targetProxy)
        {
            var m  = actorProxy.baseEntity as Minion_Support;
            var ts = actorProxy.transform;

            if (targetProxy == null || targetProxy.baseEntity.isAlive == false)
            {
                m.collider.enabled = true;
                yield break;
            }

            m.collider.enabled = false;
            ts.LookAt(targetProxy.transform);

            yield return(null);

            if (targetProxy == null)
            {
                yield break;
            }

            SoundManager.instance.Play(m.clip_Jump);

            actorProxy.PlayAnimationWithRelay(AnimationHash.Skill, targetProxy.baseEntity);

            var startPos  = ts.position;
            var targetPos = targetProxy.transform.position;
            var t         = 0f;

            float fV_x;
            float fV_y;
            float fV_z;

            float fg;
            float fEndTime;
            float fMaxHeight = 2f;
            float fHeight;
            float fEndHeight;
            float fTime    = 0f;
            float fMaxTime = 0.75f;

            fEndHeight = targetPos.y - startPos.y;
            fHeight    = fMaxHeight - startPos.y;
            fg         = 2 * fHeight / (fMaxTime * fMaxTime);
            fV_y       = Mathf.Sqrt(2 * fg * fHeight);

            float a = fg;
            float b = -2 * fV_y;
            float c = 2 * fEndHeight;

            fEndTime = (-b + Mathf.Sqrt(b * b - 4 * a * c)) / (2 * a);

            fV_x = -(startPos.x - targetPos.x) / fEndTime;
            fV_z = -(startPos.z - targetPos.z) / fEndTime;

            var currentPos = new Vector3();

            while (t < fEndTime)
            {
                t += Time.deltaTime;

                currentPos.x = startPos.x + fV_x * t;
                currentPos.y = startPos.y + (fV_y * t) - (0.5f * fg * t * t);
                currentPos.z = startPos.z + fV_z * t;

                ts.position = currentPos;

                yield return(null);
            }

            m.collider.enabled = true;
            var pos = ts.position;

            pos.y = 0.1f;

            SoundManager.instance.Play(m.clip_Landing);
            PoolManager.Get().ActivateObject(m.pref_Dust.name, pos);
            yield return(null);
        }