private void State_Complete(Spine.TrackEntry trackEntry)
    {
        if (trackEntry.animation.name == "transform")
        {
            m_rotate = m_me.GetComponent <Stage1BOSS>().m_patternDRotate;
            m_rotate.transform.position = m_me.transform.position;
            m_rotate.gameObject.SetActive(true);
            m_rotate.transform.localScale = new Vector3(3, 3);

            // 다시 생겼을 때
            if (m_moveEffect)
            {
                m_effect = false;
                iTween.ScaleTo(m_rotate, iTween.Hash("x", 0.0f, "y", 0.0f));
                m_skletonAnimation.state.SetAnimation(2, "move_fast_close", true);
                NetworkManager.Instance().SendOrderMessage(
                    JSONMessageTool.ToJsonAIMessage(m_aiTarget, "D", "move_fast_close", true));
            }
            else
            {
                m_effect = true;
                NetworkManager.Instance().SendOrderMessage(
                    JSONMessageTool.ToJsonAIMessage(m_aiTarget, "D", "attack_D_in", false));
                m_skletonAnimation.state.SetAnimation(2, "attack_D_in", false);
            }
        }
        if (trackEntry.animation.name == "attack_D_in")
        {
        }
    }
Esempio n. 2
0
    public override float Attack()
    {
        m_curState = "attack";

        if (m_heroTarget == null)
        {
            return(1.0f);
        }

        Vector3 pos  = transform.position;
        Vector3 hero = m_heroTarget.transform.position;

        if (pos.x <= hero.x)
        {
            m_skeletonAnimation.skeleton.flipX = true;
        }
        else
        {
            m_skeletonAnimation.skeleton.flipX = false;
        }

        if (Mathf.Abs(Vector3.Distance(pos, hero)) <= 51.0f)
        {
            CheckAndSetAnimation(0, ANI_ATTACK, false);
            if (!m_curState.Equals(m_prevState))
            {
                m_source.Play();
                NetworkManager.Instance().SendOrderMessage(
                    JSONMessageTool.ToJsonAIMessage(m_name, "", ANI_ATTACK, false));
            }
        }
        return(1.0f);
    }
Esempio n. 3
0
    public override float Attack(GameObject hero, GameObject me, int index)
    {
        m_tick   += Time.deltaTime;
        m_hero    = hero;
        m_monster = me;
        // 패턴 A
        // 플레이어 위치를 추적하여 직선으로 날아가는 탄환 발사

        // 탄환 3발 발사
        // 2초마다 한번씩
        if (m_tick >= GameSetting.BOSS1_PATTERN_B_ATTACK_COOLTIME)
        {
            //  BulletManager.Instance().AddBullet(BulletManager.BULLET_TYPE.B_BOSS1_P1);
            m_skletonAnimation.state.SetAnimation(0, m_attackAni, true);
            NetworkManager.Instance().SendOrderMessage(
                JSONMessageTool.ToJsonAIMessage(
                    m_aiTarget,
                    "B",
                    m_attackAni,
                    false));
            return(GameSetting.BOSS1_PATTERN_B_ATTACK_COOL);
        }

        return(0.0f);
    }
Esempio n. 4
0
    protected override void Move()
    {
        if (m_damageCoolTime)
        {
            return;
        }
        CheckAndSetAnimation(0, ANI_MOVE, true);
        bool  flip = m_skeletonAnimation.skeleton.flipX;
        float dir  = (flip) ? 1.0f : -1.0f;

        if (m_target == null)
        {
            m_curState = "move";
        }

        transform.Translate(
            new Vector3(GameSetting.HERO_MOVE_SPEED * Time.deltaTime * dir, 0.0f));

        if (m_curState != m_prevState)
        {
            NetworkManager.Instance().SendOrderMessage(
                JSONMessageTool.ToJsonAIMessage(m_name, "", ANI_MOVE, true));
        }

        MoveSend();
    }
    public override void PatternStart()
    {
        m_skletonAnimation.state.SetAnimation(2, "transform", false);

        NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonAIMessage(m_aiTarget, "D", "transform", false));

        m_skletonAnimation.state.Complete += State_Complete;
    }
Esempio n. 6
0
 public PatternA(SkeletonAnimation ani, string moveAni, string attackAni, string aiTarget) : base(ani, moveAni, attackAni, aiTarget)
 {
     m_skletonAnimation.state.Complete += State_Complete;
     m_skletonAnimation.state.SetAnimation(0, m_moveAni, true);
     NetworkManager.Instance().SendOrderMessage(
         JSONMessageTool.ToJsonAIMessage(
             m_aiTarget,
             "A",
             m_moveAni,
             true));
 }
Esempio n. 7
0
    // ---------------------------------------------------------------------//

    public override void PatternStart()
    {
        m_skletonAnimation.state.SetAnimation(2, "transform", false);
        m_skletonAnimation.state.AddAnimation(2, "attack_C_charge", false, 0.0f);
        m_skletonAnimation.state.AddAnimation(2, "attack_C_fire", false, 0.0f);


        NetworkManager.Instance().SendOrderMessage(
            JSONMessageTool.ToJsonAIMessage(m_aiTarget, "C", new string[] { "transform", "attack_C_charge", "attack_C_fire" }));

        m_skletonAnimation.gameObject.GetComponent <AudioSource>().Play();
        m_skletonAnimation.state.Complete += CompleteEvent;
        base.PatternStart();
    }
    protected override void Move()
    {
        if (m_damageCoolTime)
        {
            return;
        }
        CheckAndSetAnimation(0, ANI_MOVE, true);
        bool       flip = m_skeletonAnimation.skeleton.flipX;
        GameObject cur  = (m_currentDirLeft) ? m_leftLimit : m_rightLimit;
        Vector3    dir  = (new Vector3(cur.transform.position.x, transform.position.y, transform.position.z))
                          - transform.position;

        dir.Normalize();

        if (m_target == null)
        {
            m_curState = "move";
        }

        transform.position += dir * GameSetting.HERO_MOVE_SPEED * Time.deltaTime;

        if (m_currentDirLeft)
        {
            if (transform.position.x <= m_leftLimit.transform.position.x)
            {
                m_skeletonAnimation.skeleton.flipX = true;
                m_currentDirLeft = false;
            }
        }
        else
        {
            if (transform.position.x >= m_rightLimit.transform.position.x)
            {
                m_skeletonAnimation.skeleton.flipX = false;
                m_currentDirLeft = true;
            }
        }

        if (m_curState != m_prevState)
        {
            NetworkManager.Instance().SendOrderMessage(
                JSONMessageTool.ToJsonAIMessage(m_name, "", ANI_MOVE, true));
        }

        MoveSend();
    }
Esempio n. 9
0
    protected override void Move()
    {
        if (m_pattern != null)
        {
            if (m_tutorial)
            {
                m_pattern.Move(gameObject, m_tutoRobo.gameObject);
            }
            else
            {
                m_pattern.Move(gameObject, m_robo.gameObject);
            }
        }



        if (m_robo.transform.position.x < transform.position.x)
        {
            m_skeletonAnimation.skeleton.flipX = false;
        }
        else
        {
            m_skeletonAnimation.skeleton.flipX = true;
        }


        if (m_tutorial)
        {
            return;
        }
        base.Move();


        if (!AttackAbleCheck())
        {
            m_curState = "move";
        }

        if (m_curState != m_prevState)
        {
            NetworkManager.Instance().SendOrderMessage(
                JSONMessageTool.ToJsonAIMessage(m_name, "", ANI_MOVE, true));
        }
        MoveSend();
    }
Esempio n. 10
0
 public override float Attack()
 {
     m_curState = "attack";
     if (m_tutorial)
     {
         float coolTime = 0.0f;
         if (m_pattern != null)
         {
             coolTime = m_pattern.Attack(m_tutoRobo.gameObject, gameObject, m_index);
         }
         return(coolTime);
     }
     if (m_curState != m_prevState)
     {
         NetworkManager.Instance().SendOrderMessage(
             JSONMessageTool.ToJsonAIMessage(m_name, "", ANI_ATTACK, true));
     }
     return(base.Attack());
 }
Esempio n. 11
0
    private void State_Complete(Spine.TrackEntry trackEntry)
    {
        if (trackEntry.animation.name.Equals(m_attackAni))
        {
            if (m_tick >= GameSetting.BOSS1_PATTERN_A_ATTACK_COOLTIME)
            {
                Bullet  b   = BulletManager.Instance().AddBullet(BulletManager.BULLET_TYPE.B_BOSS1_P1);
                Vector3 pos = m_monster.transform.position;

                b.transform.position = pos;

                Vector3 dir = m_hero.transform.position - m_monster.transform.position;
                dir.Normalize();
                string name = GameManager.Instance().PLAYER.USER_NAME + "_boss_A_" + Monster.m_index++;

                b.BULLET_SPEED       = 20.0f;
                b.transform.position = m_monster.transform.position;
                b.SetupBullet(name, false, dir);

                NetworkManager.Instance().SendOrderMessage(
                    JSONMessageTool.ToJsonCreateOrder(
                        name,
                        "boss1_bullet",
                        pos.x, pos.y,
                        b.transform.rotation.eulerAngles.y,
                        false));
                // 총알은 2.5초에 걸쳐 플레이어에게 도착함
                // 총알의 계산은 총알에서 하도록 함
                m_tick = 0.0f;

                //m_monster.GetComponent<Stage1BOSS>().m_attackEffect.Play("boss_shotEffect");

                NetworkManager.Instance().SendOrderMessage(
                    JSONMessageTool.ToJsonAIMessage(
                        m_aiTarget,
                        "A",
                        m_moveAni,
                        true));
                m_skletonAnimation.state.SetAnimation(0, m_moveAni, true);
            }
        }
    }
Esempio n. 12
0
    public override float Attack()
    {
        m_curState = "attack";
        m_skeletonAnimation.state.SetAnimation(0, ANI_ATTACK_PREV, false);
        m_skeletonAnimation.state.AddAnimation(0, ANI_ATTACK, false, 0.0f);

        AudioSource source = this.GetComponent <AudioSource>();

        if (source != null && !source.isPlaying)
        {
            source.Play();
        }

        if (m_curState != m_prevState)
        {
            NetworkManager.Instance().SendOrderMessage(
                JSONMessageTool.ToJsonAIMessage(m_name, "", new string[] { ANI_ATTACK_PREV, ANI_ATTACK }));
        }

        return(1.0f);
    }
    public override float Attack()
    {
        if (m_hasAttackAnimation)
        {
            return(0.0f);
        }

        m_curState = "attack";

        if (m_curState != m_prevState)
        {
            if (!m_source.isPlaying)
            {
                m_source.Play();
            }
            NetworkManager.Instance().SendOrderMessage(
                JSONMessageTool.ToJsonAIMessage(m_name, "", ANI_ATTACK, false));
        }

        return(1.0f);
    }
Esempio n. 14
0
    bool FindMoveAbleCheck()
    {
        Vector3 roboPos = (!m_tutorial) ? m_robo.transform.position : m_tutoRobo.transform.position;
        Vector3 pos     = transform.position;

        if (Vector3.Distance(roboPos, pos) <= GameSetting.MONSTER_FIND_DISTANCE)
        {
            return(true);
        }
        m_curState = "idle";

        if (m_tutorial)
        {
            return(false);
        }
        if (m_curState != m_prevState)
        {
            NetworkManager.Instance().SendOrderMessage(
                JSONMessageTool.ToJsonAIMessage(m_name, "", ANI_IDLE, true));
        }
        return(false);
    }