public async void SendMsg(string type, string content) { var res = await client.BroadcastMessageAsync(new Message { PlayerId = m_PlayerID, RoomId = m_RoomID, ContentType = type, Content = content, Timestamp = ZUtils.GetTimeStamp().ToString(), }); Debug.Log("sendmsg"); }
void OnDrawGizmos() { if (_isInitialized && showDebug) { for (int r = 0; r < rows; ++r) { for (int c = 0; c < cols; ++c) { Cell cell = _grid[r, c]; if (cell.parent != null) { Vector3 dirn = cell.parent.GetPosition() - cell.GetPosition(); ZUtils.DrawGizmoArrow(cell.GetPosition(), dirn / 3, SteeringManager.Instance.useXYPlane); } } } } }
public override void InitForFrame() { base.InitForFrame(); // Scale the detection box based on velocity _adjustedFeelerLength = feelerLength + feelerLength / 2 * _steeringCharacter.Velocity.magnitude / _steeringCharacter.maxSpeed; _startPos = _steeringCharacter.Position; _feelers[0] = _startPos + _steeringCharacter.Heading * _adjustedFeelerLength; if (SteeringManager.Instance.useXYPlane) { _feelers[1] = _startPos + ZUtils.RotateByAngleOnZAxis(_steeringCharacter.Heading, feelerAngle) * feelerLength; _feelers[2] = _startPos + ZUtils.RotateByAngleOnZAxis(_steeringCharacter.Heading, -feelerAngle) * feelerLength; } else { _feelers[1] = _startPos + ZUtils.RotateByAngleOnYAxis(_steeringCharacter.Heading, feelerAngle) * feelerLength; _feelers[2] = _startPos + ZUtils.RotateByAngleOnYAxis(_steeringCharacter.Heading, -feelerAngle) * feelerLength; } _listOfWalls = SteeringManager.Instance.GetWalls(); _numWalls = _listOfWalls.Count; }
void OnDrawGizmos() { if (showDebugGizmos && SteeringManager.Instance != null) { Gizmos.color = _currentDebugColor; if (SteeringManager.Instance.useXYPlane) { Gizmos.DrawCube(transform.position, new Vector3(width, height, 0)); } else { Gizmos.DrawCube(transform.position, new Vector3(width, 0, height)); } Gizmos.color = Color.green; ZUtils.DrawGizmoArrow(transform.position, avoidDirn * 5, SteeringManager.Instance.useXYPlane); Gizmos.color = Color.yellow; Gizmos.DrawSphere(transform.position, 0.5f); Gizmos.DrawSphere(_p2, 0.5f); Gizmos.DrawSphere(_p3, 0.5f); Gizmos.DrawLine(_p2, _p3); } }
void CreateTile(CellGrid.Cell cell, TILE_TYPE tileType, TileConnector parentConnector = null) { ZUtils.RandomizeList <Tile>(ref _baseTileSet); Tile newTile = null; if (tileType == TILE_TYPE.START) { newTile = FindStartTile(); } else if (tileType == TILE_TYPE.CONNECTION) { newTile = FindConnectionTile(cell); } else if (tileType == TILE_TYPE.CONNECTION_FILLER) { newTile = FindConnectionTileToFill(cell); } else if (tileType == TILE_TYPE.END) { newTile = FindEndTile(parentConnector); _endTile = _endTile; } else if (tileType == TILE_TYPE.DEAD_END) { newTile = FindDeadEndTile(parentConnector); } if (newTile == null) { // No valid option right now, move to next step return; } GameObject newTileGO = Instantiate(newTile.gameObject); Transform newTileT = newTileGO.transform; newTileT.SetParent(_dungeonT); newTileT.position = cell.Position; newTile = newTileGO.GetComponent <Tile>(); if (parentConnector != null) { TileConnector childConnector = newTile.GetOppositeConnector(parentConnector.direction); if (childConnector != null) { TileConnector.Connect(childConnector, parentConnector); } else { Debug.Log("Error: Unable to find a connector so skipping"); return; } } newTile.Init(cell, _cellGrid); if (AllowNewConnections(tileType)) { // Add free connections List <TileConnector> freeConnectionList = newTile.GetFreeConnections(); for (int i = 0; i < freeConnectionList.Count; ++i) { _listOfFreeConnections.Add(freeConnectionList[i]); } } // Reiterate free connection list for new blockers for (int i = 0; i < _listOfFreeConnections.Count; ++i) { _listOfFreeConnections[i].UpdateBasedOnGrd(_cellGrid); if (!_listOfFreeConnections[i].IsFree()) { _listOfFreeConnections[i].SetToInvalid(); _listOfFreeConnections.RemoveAt(i); --i; } } _dungeonTiles.Add(newTile); _cellObjectList.Add(newTileGO); _numTilesCreated++; if (tileType == TILE_TYPE.START) { _startTile = newTile; } else if (tileType == TILE_TYPE.END) { _endTile = newTile; } //Debug.Log("GenNextTile: " + _numCellsCreated.ToString() + " " + _listOfFreeConnections.Count.ToString()); }
public List <TileConnector> GetFreeConnections() { ZUtils.RandomizeList <TileConnector>(ref _listOfFreeConnections); return(_listOfFreeConnections); }