コード例 #1
0
    public void Damage(int damage, string boneName)
    {
        base.Damage(damage);
        SpriteRenderer target = null;

        if (boneName.Equals("head"))
        {
        }
        else if (boneName.Equals("Tail"))
        {
        }
        else
        {
            string num = Regex.Replace(boneName, @"\D", "");
            MDebug.Log(boneName);
            int index = int.Parse(num);
            target = m_destroyBoneList[index - 1].m_renderer;

            m_destroyBoneList[index - 1].m_hp -= 1;

            if (m_destroyBoneList[index - 1].m_hp <= 0)
            {
                m_destroyBoneList[index - 1].m_renderer.enabled = true;
                NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonPartDestroy(index - 1));
            }
        }
        NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonHPUdate(m_name, m_hp));
    }
コード例 #2
0
    // 몬스터 HP Update
    public void MonsterHPUpdate(int curHP, int maxHP)
    {
        if (maxHP == 0)
        {
            return;
        }
        MDebug.Log("h " + curHP + " max " + maxHP);
        float         percent = ((float)curHP / (float)maxHP);
        float         width   = m_topEnemyHPBar.sprite.rect.size.x;
        RectTransform t       = m_topEnemyHPBar.GetComponent <RectTransform>();

        t.sizeDelta = new Vector2(width * percent, t.sizeDelta.y);

        float arrowWidth = m_enemyHPLeftArrow.sprite.rect.size.x * 0.5f;

        Vector3 left = new Vector3(
            m_topEnemyHPBar.transform.position.x - (t.sizeDelta.x / 2.0f) - arrowWidth,
            m_enemyHPLeftArrow.transform.position.y);
        Vector3 right = new Vector3(
            m_topEnemyHPBar.transform.position.x + (t.sizeDelta.x / 2.0f) + arrowWidth,
            m_enemyHPLeftArrow.transform.position.y);

        m_enemyHPLeftArrow.transform.position  = left;
        m_enemyHPRightArrow.transform.position = right;

        NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonHPUdate("targetMon", percent));
    }
コード例 #3
0
    public override void Damage(int damage)
    {
        base.Damage(damage);

        if (!m_tutorial)
        {
            NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonHPUdate(m_name, m_hp));
        }

        if (m_hp <= 0)
        {
            MapManager.Instance().AddObject(GamePath.EFFECT, transform.position);

            if (!m_tutorial)
            {
                NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonRemoveOrder(m_name, "Monster"));
                NetworkManager.Instance().RemoveNetworkOrderMessageEventListener(this);
            }
            else
            {
                m_tutoRobo.TutoKillMonster();
            }

            GameObject.Destroy(gameObject);
        }
    }
コード例 #4
0
    void CompleteAnimation(TrackEntry trackEntry)
    {
        if (trackEntry.animation.name.Equals(ANI_REPAIR))
        {
            m_curState = BitControl.Clear(m_curState, (int)HERO_STATE.ATTACK);
            m_skletonAnimation.state.ClearTrack(1);

            if (!m_isMe)
            {
                return;
            }
            if (m_damagePointFix != null)
            {
                m_damagePointFix.GetComponent <RoboDamagePoint>().DamageFix();
            }
            else if (m_monster != null)
            {
                if (m_monster.enabled)
                {
                    m_monster.Damage(1);
                }
                else
                {
                    NetworkManager.Instance().SendOrderMessage(
                        JSONMessageTool.ToJsonHPUdate(m_monster.MONSTER_NAME, 1));
                }
            }
        }
    }
コード例 #5
0
 public override void Damage(int damage)
 {
     base.Damage(damage);
     if (m_hp <= 0)
     {
         MapManager.Instance().AddObject(GamePath.EFFECT, transform.position);
         NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonRemoveOrder(m_name, "Monster"));
         GameObject.Destroy(gameObject);
         return;
     }
     NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonHPUdate(m_name, m_hp));
 }
コード例 #6
0
    public override void Damage(int damage)
    {
        if (m_damageCoolTime)
        {
            return;
        }
        m_hp -= damage;
        if (m_hp <= 0)
        {
            MapManager.Instance().AddObject(GamePath.EFFECT, transform.position);
            NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonRemoveOrder(m_name, "Monster"));
            NetworkManager.Instance().RemoveNetworkOrderMessageEventListener(this);
            GameObject.Destroy(gameObject);
            return;
        }

        m_damageCoolTime = true;
        InvokeRepeating("DamageEffect", 0.1f, 0.1f);
        NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonHPUdate(m_name, m_hp));
    }
コード例 #7
0
    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);
                    }
                }
            }
        }
    }