public SpawnedObject getSpawnedObjectInformation(Area area, Transform location) { SpawnedObject.Builder builder = SpawnedObject.CreateBuilder(); string description = WorldMap.getDescriptionForStarAt(area.position.x, area.position.y); GlobalPosition.Builder pBuilder = GlobalPosition.CreateBuilder(); pBuilder.SetAreaX(area.position.x); pBuilder.SetAreaY(area.position.y); pBuilder.SetLocalX((int)location.position.x); pBuilder.SetLocalY((int)location.position.z); builder.SetObjectPosition(pBuilder.Build()); Weapon weaponAssociated = gameObject.GetComponent <Weapon> (); if (weaponAssociated != null) { builder.SetObjectData(getDirectObject().getDirectObjectAsProtobuf(weaponAssociated)); } else { builder.SetObjectData(getDirectObject().getDirectObjectAsProtobuf()); } builder.SetDescription(description); return(builder.Build()); }
public PlayerStatus getPlayerStatus() { PlayerStatus.Builder builder = PlayerStatus.CreateBuilder(); builder.SetName(name); builder.SetStrength(strength); builder.SetDefence(defense); builder.SetEfficiency(efficiency); builder.SetEncryption(encryption); builder.SetSecurity(security); builder.SetAlgorithmPoints(algorithmPoints); builder.SetIntegrity(integrity); builder.SetRma(rma); builder.SetDeaths(deaths); builder.SetXpBytes(xpBytes); //builder.SetBytes (bytes); //builder.SetBytesRemaining (bytesToNextVersion); GlobalPosition.Builder positionBuilder = GlobalPosition.CreateBuilder(); positionBuilder.SetAreaX(MasterDriver.Instance.CurrentArea.position.x); positionBuilder.SetAreaY(MasterDriver.Instance.CurrentArea.position.y); positionBuilder.SetLocalX((int)gameObject.transform.position.x); positionBuilder.SetLocalY((int)gameObject.transform.position.z); builder.SetPlayerPosition(positionBuilder.Build()); builder.SetRotation((int)MasterDriver.Instance.getCamera().rotation.eulerAngles.y); InventoryData.Builder inventoryBuilder = InventoryData.CreateBuilder(); foreach (Item i in inventory) { if (i.gameObject.GetComponent <Weapon>() == null) { inventoryBuilder.AddObject(i.getDirectObject().getDirectObjectAsProtobuf()); } else { Debug.Log("SAVING WEAPON"); inventoryBuilder.AddObject(i.getDirectObject().getDirectObjectAsProtobuf((Weapon)i)); } } builder.SetInventory(inventoryBuilder.Build()); builder.SetVersion(version); List <Point> visitedAreas = Status.playerStatus.getVisitedAreas(); foreach (Point p in visitedAreas) { PointProto.Builder pBuilder = PointProto.CreateBuilder(); pBuilder.SetX(p.x); pBuilder.SetY(p.y); builder.AddVisitedAreas(pBuilder.Build()); } return(builder.Build()); }
public SpawnedObject getSpawnedObjectInformation(Area area) { SpawnedObject.Builder builder = SpawnedObject.CreateBuilder(); string description = WorldMap.getDescriptionForStarAt(area.position.x, area.position.y); GlobalPosition.Builder pBuilder = GlobalPosition.CreateBuilder(); pBuilder.SetAreaX(area.position.x); pBuilder.SetAreaY(area.position.y); pBuilder.SetLocalX((int)gameObject.transform.position.x); pBuilder.SetLocalY((int)gameObject.transform.position.z); builder.SetObjectPosition(pBuilder.Build()); builder.SetObjectData(getDirectObject().getDirectObjectAsProtobuf()); builder.SetDescription(description); EnemyData.Builder eBuilder = EnemyData.CreateBuilder(); eBuilder.SetHealthRemaining((int)hp); builder.SetEnemyAttributes(eBuilder.Build()); return(builder.Build()); }