Beispiel #1
0
    // ================================================================ //
    //
    //  보스 관계 조작 명령 패킷 수신.
    //

    public void OnReceiveDirectAttackPacket(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)
            {
                BossDirectPacket packet = new BossDirectPacket(data);
                BossDirectAttack attack = packet.GetPacket();

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

                Debug.Log("Receive boss direct attack[Power:" + attackPower + " Target:" + targetName + "]");
                bossController.cmdBossDirectAttack(targetName, attackPower);
            }
        }
    }
Beispiel #2
0
	// ================================================================ //
	//
	//  보스 관계 조작 명령 패킷 수신.
	//
	
	public void OnReceiveDirectAttackPacket(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)
			{
				BossDirectPacket packet = new BossDirectPacket(data);
				BossDirectAttack attack = packet.GetPacket();

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

				Debug.Log("Receive boss direct attack[Power:" + attackPower + " Target:" + targetName + "]");
				bossController.cmdBossDirectAttack(targetName, attackPower);
			}
		} 
	}