This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using agora_gaming_rtc; | |
using Tanks.TankControllers; | |
#if (UNITY_ANDROID && UNITY_2018_3_OR_NEWER) | |
using UnityEngine.Android; | |
#endif | |
public class AgoraVideoController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using TankNt = Tanks.Networking; | |
public class AgoraPlayerController | |
{ | |
private Dictionary<TankNt.NetworkPlayer, uint> NetworkToAgoraIDMap = new Dictionary<TankNt.NetworkPlayer, uint>(); | |
private List<TankNt.NetworkPlayer> m_NetworkPlayers = new List<TankNt.NetworkPlayer>(); | |
private List<uint> m_AgoraUserIds = new List<uint>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// new code | |
GameManager.AddTank(this); | |
StartCoroutine(SetupVideoSurface(player)); | |
} // end of Initialize(TanksNetworkPlayer player) | |
IEnumerator SetupVideoSurface(TanksNetworkPlayer player) | |
{ | |
Debug.Log("Tank initializing player:" + player); | |
yield return new WaitForFixedUpdate(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
namespace Tanks.Utilities { | |
public class FixedRotation : MonoBehaviour | |
{ | |
// Plane facing front | |
readonly Quaternion m_Rotation = Quaternion.Euler(-45,45,0); | |
void LateUpdate() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
using Tanks.Map; | |
using Tanks.Rules; | |
using Tanks.Networking; | |
using Tanks.Utilities; | |
#if PLATFORM_ANDROID | |
using UnityEngine.Android; | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When a remote user joined, this delegate will be called. Typically | |
// create a GameObject to render video on it | |
private void onUserJoined(uint uid, int elapsed) | |
{ | |
Debug.Log ("onUserJoined: uid = " + uid); | |
// this is called in main thread | |
// find a game object to render video stream from 'uid' | |
GameObject go = GameObject.Find (uid.ToString ()); | |
if (!ReferenceEquals (go, null)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Serializable] | |
public class DrawmarkModel | |
{ | |
public Color color; | |
public List<Vector2> points; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IEnumerator CoProcessDrawing(DrawmarkModel dm) | |
{ | |
string json = JsonUtility.ToJson(dm); | |
if (dataStreamId > 0) | |
{ | |
rtcEngine.SendStreamMessage(dataStreamId, json); | |
} | |
yield return null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int dotCount = 0; | |
/// <summary> | |
/// | |
/// </summary> | |
/// <param name="pos">Screen Position</param> | |
void DrawDot(Vector2 pos) | |
{ | |
if (anchorGO == null) | |
{ | |
anchorGO = new GameObject(); |
OlderNewer