public override float Attack(GameObject hero, GameObject me, int index)
    {
        //m_tick += Time.deltaTime;

        //if(m_tick >= 1000.0f)
        //{
        m_skletonAnimation.state.SetAnimation(0, m_attackAni, false);
        //    m_tick = 0.0f;
        //}
        TutoRobo r = hero.GetComponent <TutoRobo>();

        if (r != null)
        {
            r.Damage(1);
        }
        else
        {
            HeroRobo robo = hero.GetComponent <HeroRobo>();
            if (robo != null)
            {
                robo.Damage(1);
            }
        }

        return(1.0f);
    }
Exemplo n.º 2
0
    private void State_Complete(Spine.TrackEntry trackEntry)
    {
        if (trackEntry.animation.name.Equals(ANI_ATTACK))
        {
            m_skeletonAnimation.state.SetAnimation(0, ANI_MOVE, true);
            if (m_attackTarget != null)
            {
                if (!m_tutorial)
                {
                    HeroRobo robo = m_attackTarget.GetComponent <HeroRobo>();

                    if (robo != null)
                    {
                        robo.Damage(m_power);
                    }
                    else
                    {
                        Hero hero = m_attackTarget.GetComponent <Hero>();

                        if (hero != null)
                        {
                            hero.Damage(m_power);
                        }
                    }
                }
                else
                {
                    TutoRobo robo = m_attackTarget.GetComponent <TutoRobo>();

                    if (robo != null)
                    {
                        robo.Damage(m_power);
                    }
                }
            }
        }
    }
    void OnTriggerEnter2D(Collider2D col)
    {
        if (m_isNetworkObject)
        {
            return;
        }


        //맵 바깥쪽에 도착했다.
        if (col.transform.tag.Equals("OUTLINE"))
        {
            DeleteBullet();
        }
        else
        {
            if (col.transform.tag.Equals("ENEMY") && m_curTarget == BULLET_TARGET.PLAYER)
            {
                Monster mon = col.GetComponent <Monster>();
                GameManager.Instance().SetCurrentEnemy(mon);
                if (mon.enabled)
                {
                    mon.Damage(1);
                }
                else
                {
                    NetworkManager.Instance().SendOrderMessage(
                        JSONMessageTool.ToJsonHPUdate(mon.MONSTER_NAME, 1));
                }
                DeleteBullet();
            }
            else if (col.transform.tag.Equals("BOSS") && m_curTarget == BULLET_TARGET.PLAYER)
            {
                Stage1BOSS boss = col.GetComponent <Stage1BOSS>();
                GameManager.Instance().SetCurrentEnemy(boss);
                if (boss.enabled)
                {
                    boss.Damage(8);
                }
                else
                {
                    NetworkManager.Instance().SendOrderMessage(
                        JSONMessageTool.ToJsonDamage(boss.MONSTER_NAME, 8));
                }
                DeleteBullet();
            }
            else if (col.transform.tag.Equals("BOSS2") && m_curTarget == BULLET_TARGET.PLAYER)
            {
                Stage2BossBone bone = col.GetComponent <Stage2BossBone>();
                GameManager.Instance().SetCurrentEnemy(bone.m_boss2);
                if (bone.m_boss2.enabled)
                {
                    bone.m_boss2.Damage(8, bone.name);
                }
                else
                {
                    NetworkManager.Instance().SendOrderMessage(
                        JSONMessageTool.ToJsonDamage(bone.m_boss2.MONSTER_NAME, 8));
                }
                DeleteBullet();
            }
            else if (col.transform.tag.Equals("Player") && m_curTarget == BULLET_TARGET.ENEMY)
            {
                // 데미지 받는 처리
                //Vector3 bulletPos = transform.position;
                //Vector3 targetPos = col.transform.position;
                //Vector3 createPos = Vector3.zero;

                DeleteBullet();
                HeroRobo robo = col.GetComponent <HeroRobo>();
                if (robo != null)
                {
                    robo.Damage(1);
                }
                else
                {
                    Hero hero = col.GetComponent <Hero>();
                    if (hero != null)
                    {
                        hero.Damage(1);
                    }
                }
            }
        }
    }