Example #1
0
        public static string FormatMob(PlacedMob mob)
        {
            string optionalFields = "";
            string dead;

            if (mob.HasBeenKilled())
            {
                dead = "true";
            }
            else
            {
                optionalFields = string.Format(OPTIONAL_MOB_FIELDS_TEMPLATE,
                                               mob.GetGameObject().transform.position.x,
                                               AntiCorruption.FixHandedness(mob.GetGameObject().transform.position.z),
                                               Mathf.RoundToInt(mob.GetGameObject().transform.rotation.eulerAngles.y),
                                               GetDamageable(mob.GetGameObject()).GetMaxHealth(),
                                               GetDamageable(mob.GetGameObject()).GetHealth());
                dead = "false";
            }

            return(string.Format(MOB_TEMPLATE,
                                 mob.GetName(),
                                 optionalFields,
                                 mob.GetId(),
                                 dead));
        }
Example #2
0
 public static string FormatRoom(PlacedPrefab room)
 {
     return(string.Format(ROOM_TEMPLATE,
                          room.GetName(),
                          room.GetPosition().x,
                          AntiCorruption.FixHandedness(room.GetPosition().z),
                          Mathf.RoundToInt(room.GetRotation().eulerAngles.y)));
 }
Example #3
0
 public static string FormatVRPlayer(GameObject player)
 {
     return(string.Format(VR_PLAYER_TEMPLATE,
                          player.transform.position.x,
                          AntiCorruption.FixHandedness(player.transform.position.z),
                          Mathf.RoundToInt(player.transform.rotation.eulerAngles.y),
                          GetDamageable(player).GetMaxHealth(),
                          GetDamageable(player).GetHealth()));
 }
        public void ResolveMessage(string msg)
        {
            Command command = parserLibrary.Parse(msg);

            if (command == null)
            {
                return;
            }

            switch (command.GetCommandType())
            {
            case CommandType.BUILD:
                var buildCommand = (BuildCommand)command;
                worldManager.AddPrefab(buildCommand.GetObjectId(), buildCommand.GetXPos(), AntiCorruption.FixHandedness(buildCommand.GetZPos()), buildCommand.GetRot());
                break;

            case CommandType.SPAWNMOB:
                var spawnMobCommand = (SpawnMobCommand)command;
                worldManager.SpawnMob(spawnMobCommand.GetObjectId(), spawnMobCommand.GetXPos(), AntiCorruption.FixHandedness(spawnMobCommand.GetZPos()), spawnMobCommand.GetId());
                break;
            }
        }