public void Tick(float dt) { if ( Input.GetKey(KeyCode.LeftShift) && Input.GetMouseButtonDown(1) && Physics.Raycast(Camera.main.ScreenPointToRay(new Vector2(Input.mousePosition.x, Input.mousePosition.y)), out var hit) ) { Debug.Log("spawn at " + hit.point); var spawnCommand = new SpawnCommand { position = hit.point }; network.Send(spawnCommand); } }
public void Tick(float dt) { var mousePosition = Input.mousePosition; if ( !Input.GetMouseButtonDown(1) || gameState.selectedActors.Count == 0 || !Physics.Raycast(Camera.main.ScreenPointToRay(new Vector2(mousePosition.x, mousePosition.y)), out var hit) ) { return; } var moveCommand = new MoveCommand { position = hit.point, units = gameState.selectedActors.ToArray() }; network.Send(moveCommand); //Entity.Create().Set(moveCommand); }