コード例 #1
0
 private static void OnEntityRemoved(IMyEntity myEntity)
 {
     if (myEntity.GetType() != typeof(MyCubeGrid))
     {
         return;
     }
     SpawnManagerCore.WriteToLog("OnEntityRemoved", $"Id:\t{myEntity.EntityId}\tDisplayName:\t{myEntity.DisplayName}\tPlayer:\t{0}\tDistanceTo:\t{0}", true);
 }
コード例 #2
0
        private static void PrintRangeToPlayerZero(IMyEntity entity)
        {
            if (MyAPIGateway.Multiplayer.Players.Count == 0)
            {
                SpawnManagerCore.WriteToLog("PrintRangeToPlayerZero", $"Id:\t{entity.EntityId}\tDisplayName:\t{entity.DisplayName}\tPlayer:\t{0}\tDistanceTo:\t{0}", true);
                return;
            }
            List <IMyPlayer> playerList = new List <IMyPlayer>();

            MyAPIGateway.Multiplayer.Players.GetPlayers(playerList);
            SpawnManagerCore.WriteToLog("PrintRangeToPlayerZero", $"Id:\t{entity.EntityId}\tDisplayName:\t{entity.DisplayName}\tPlayer:\t{playerList[playerList.Count - 1].DisplayName}\tDistanceTo:\t{Vector3D.Distance(playerList[playerList.Count - 1].GetPosition(), entity.GetPosition())}", true);
        }