public virtual void Init(BattleNetworkHandler handler, int clientId = -1) { this.clientId = clientId; this.handler = handler; handler.gameLoop.update += NetUpdate; handler.gameLoop.laterUpdate += NetLaterUpdate; }
void Awake() { keyboardInput = FindObjectOfType <KeyboardInput>(); handler = new BattleNetworkHandler(); handler.Connect("127.0.0.1", 9999); Physics.autoSimulation = false; }
public BattleGameLoop(BattleNetworkHandler handler, int max) { this.handler = handler; timer = new Timer(BattleApplicationBooter.deltaTime.ToFloat() * 1000); timer.Elapsed += SendFrame; timer.Enabled = true; movement = new NetJoystick(); inputUnit = new NetInputUnit[max + 1]; for (int i = 0; i < max + 1; i++) { inputUnit[i] = new NetInputUnit(); } }
public void OnInit(BattleNetworkHandler handler) { var playerPos = new Fixed2(handler.random.Range(0, 20), handler.random.Range(0, 20)); for (int i = 0; i < player; i++) { var netObj = new CharacterNetController(); netObj.Init(handler, i); netObj.prefab = "Player1"; var col = netObj.AddComponent <BoxCollision>(); col.width = 1.ToFixed(); col.height = 1.ToFixed(); var localPos = playerPos + Fixed2.left * i.ToFixed() * 10.ToFixed(); netObj.transform.position = new Fixed3(localPos.x, Fixed.zero, localPos.y); netObj.InstantiateGameObject(); } }
public override void Init(BattleNetworkHandler handler, int clientId = -1) { base.Init(handler, clientId); input = handler.gameLoop[clientId]; }