Browse Source

Fix breaking API changes

tags/v0.2.1
NGnius (Graham) 4 years ago
parent
commit
6acf1b7d4e
2 changed files with 5 additions and 33 deletions
  1. +5
    -7
      Pixi/PixiPlugin.cs
  2. +0
    -26
      Pixi/PlayerLocationEngine.cs

+ 5
- 7
Pixi/PixiPlugin.cs View File

@@ -7,10 +7,11 @@ using UnityEngine;
using Unity.Mathematics; // float3

using IllusionPlugin;
// using GamecraftModdingAPI;
using GamecraftModdingAPI;
using GamecraftModdingAPI.Commands;
using GamecraftModdingAPI.Utility;
using GamecraftModdingAPI.Blocks;
using GamecraftModdingAPI.Players;

namespace Pixi
{
@@ -29,8 +30,6 @@ namespace Pixi

private double blockSize = 0.2;

private PlayerLocationEngine playerLocationEngine = new PlayerLocationEngine();

// called when Gamecraft shuts down
public void OnApplicationQuit()
{
@@ -71,7 +70,6 @@ namespace Pixi
// register commands so the modding API knows about it
CommandManager.AddCommand(pixelate2DCommand);
CommandManager.AddCommand(scaleCommand);
GameEngineManager.AddGameEngine(playerLocationEngine);
GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has started up");
}
@@ -104,7 +102,7 @@ namespace Pixi
Logging.MetaLog(e.Message + "\n" + e.StackTrace);
return;
}
float3 position = playerLocationEngine.GetPlayerLocation(0u);
float3 position = new Player(PlayerType.Local).Position;
uint blockCount = 0;
position.x += 1f;
//position.y += 1f;
@@ -138,7 +136,7 @@ namespace Pixi
if (qVoxel.visible)
{
position.y = zero_y + (float)((y * blockSize + (y - scale.y) * blockSize) / 2);
Placement.PlaceBlock(qVoxel.block, position, color: qVoxel.color, darkness: qVoxel.darkness, scale: scale);
Block.PlaceNew(qVoxel.block, position, color: qVoxel.color, darkness: qVoxel.darkness, scale: scale);
blockCount++;
}
scale = new float3(1, 1, 1);
@@ -154,7 +152,7 @@ namespace Pixi
if (qVoxel.visible)
{
position.y = zero_y + (float)((height * blockSize + (height - scale.y) * blockSize) / 2);
Placement.PlaceBlock(qVoxel.block, position, color: qVoxel.color, darkness: qVoxel.darkness, scale: scale);
Block.PlaceNew(qVoxel.block, position, color: qVoxel.color, darkness: qVoxel.darkness, scale: scale);
blockCount++;
}
//position.y = zero_y;


+ 0
- 26
Pixi/PlayerLocationEngine.cs View File

@@ -1,26 +0,0 @@
using System;

using GamecraftModdingAPI.Utility;
using Svelto.ECS;
using Unity.Mathematics;
using RobocraftX.Physics;
using RobocraftX.Character;

namespace Pixi
{
internal class PlayerLocationEngine : IApiEngine
{
public string Name => "PixiPlayerLocationGameEngine";

public EntitiesDB entitiesDB { set; private get; }

public void Dispose() {}

public void Ready() {}

public float3 GetPlayerLocation(uint playerId)
{
return entitiesDB.QueryEntity<RigidBodyEntityStruct>(playerId, CharacterExclusiveGroups.OnFootGroup).position;
}
}
}

Loading…
Cancel
Save