Example #1
0
        private void OnPlayerInputEvent(object sender, PlayerInputArgs e)
        {
            if (e.inputState == InputState.Down &&
                e.playerInputType == PlayerInputType.SpawnCheat)
            {
                WorldTile worldTile = world.GetRandomSurfacedWorldTile();

                WorldTileSurface worldTileSurface = worldTile.GetRandomWalkablePlane();

                Player player = Instantiate(playerPrefab);

                // TODO: Set different parent, higher up in hierarchy
                player.transform.parent = worldTile.transform.parent;

                player.transform.position = worldTileSurface.transform.position;

                player.Activate();

                Log("Spawned player on coordinate ["
                    + worldTile.Coordinates.x + ", " + worldTile.Coordinates.y + ", " + worldTile.Coordinates.z
                    + "] on the " + worldTileSurface.SurfaceRotation + " side.");
            }
        }