Example #1
0
    public void OnReceiveQuickAttackPacket(int node, PacketId id, byte[] data)
    {
        if (m_isHost)
        {
            // 호스트의 몬스터는 실행 완료.
            return;
        }

        // 패킷에서 파라미터를 추출해서 ↓의 코드 스니펫을 호출한다.
        GameObject go = GameObject.FindGameObjectWithTag("Boss");

        if (go != null)
        {
            chrControllerEnemyBoss bossController = go.GetComponent <chrControllerEnemyBoss>();
            if (bossController != null)
            {
                BossQuickPacket packet = new BossQuickPacket(data);
                BossQuickAttack attack = packet.GetPacket();

                string targetName  = attack.target;
                float  attackPower = attack.power;

                Debug.Log("Receive boss range attack[Ramge:" + targetName + " Power:" + attackPower + "]");
                dbwin.console().print("Receive boss range attack[Ramge:" + targetName + " Power:" + attackPower + "]");

                bossController.cmdBossQuickAttack(targetName, attackPower);
            }
        }
    }
Example #2
0
        //
        public bool Serialize(BossQuickAttack packet)
        {
            bool ret = true;

            ret &= Serialize(packet.target, BossQuickAttack.characterNameLength);
            ret &= Serialize(packet.power);

            return(ret);
        }
Example #3
0
        //
        public bool Deserialize(ref BossQuickAttack element)
        {
            if (GetDataSize() == 0)
            {
                // 데이터가 설정되지 않았다.
                return(false);
            }

            bool ret = true;

            ret &= Deserialize(ref element.target, BossQuickAttack.characterNameLength);
            ret &= Deserialize(ref element.power);

            return(ret);
        }
Example #4
0
    // 보스의 퀵 공격(근접).
    public void             RequestBossQuickAttack(string targetName, float attackPower)
    {
        do
        {
            GameObject go = GameObject.FindGameObjectWithTag("Boss");

            if (go == null)
            {
                break;
            }

            chrControllerEnemyBoss bossController = go.GetComponent <chrControllerEnemyBoss>();

            if (bossController == null)
            {
                break;
            }

            bossController.cmdBossQuickAttack(targetName, attackPower);

            // 게스트 측의 보스를 움직인다. 통신 대응(패킷을 만들어 던진다).
            BossQuickAttack attack = new BossQuickAttack();

            attack.target = targetName;
            attack.power  = attackPower;

            BossQuickPacket packet = new BossQuickPacket(attack);

            if (m_network != null)
            {
                int serverNode = m_network.GetServerNode();
                m_network.SendReliable <BossQuickAttack>(serverNode, packet);
                Debug.Log("Send boss quick attack[Target" + targetName + " Power:" + attackPower + "]");
            }
        } while(false);
    }
Example #5
0
	// 보스의 퀵 공격(근접).
	public void		RequestBossQuickAttack(string targetName, float attackPower)
	{
		do {

			GameObject go = GameObject.FindGameObjectWithTag("Boss");

			if(go == null) {

				break;
			}

			chrControllerEnemyBoss bossController = go.GetComponent<chrControllerEnemyBoss>();

			if(bossController == null) {

				break;
			}

			bossController.cmdBossQuickAttack(targetName, attackPower);
	
			// 게스트 측의 보스를 움직인다. 통신 대응(패킷을 만들어 던진다).
			BossQuickAttack attack = new BossQuickAttack();

			attack.target = targetName;
			attack.power = attackPower;

			BossQuickPacket packet = new BossQuickPacket(attack);

			if (m_network != null)
			{
				int serverNode = m_network.GetServerNode();
				m_network.SendReliable<BossQuickAttack>(serverNode, packet);
				Debug.Log("Send boss quick attack[Target" + targetName + " Power:" + attackPower + "]");
			}

		} while(false);
	}