예제 #1
0
 public ClubPlayerController(
     ClubPlayerRepresentationAdapter adapter,
     ClubResourceHandler clubResourceHandler,
     PlayerResourceHandler playerResourceHandler)
 {
     this.adapter               = adapter;
     this.clubResourceHandler   = clubResourceHandler;
     this.playerResourceHandler = playerResourceHandler;
 }
예제 #2
0
 public PlayerController(
     PlayerResourceHandler resourceHandler,
     PlayerRepresentationAdapter adapter,
     JsonSchemaGenerator schemaGenerator)
 {
     this.resourceHandler = resourceHandler;
     this.adapter         = adapter;
     this.schemaGenerator = schemaGenerator;
 }
예제 #3
0
    public static void SavePlayer(PlayerHandler player, PlayerResourceHandler resources)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Path.Combine(Application.persistentDataPath, "player.data");
        FileStream      stream    = new FileStream(path, FileMode.Create);

        PlayerData data = new PlayerData(player, resources);

        formatter.Serialize(stream, data);
        stream.Close();
    }
예제 #4
0
    public PlayerData(PlayerHandler player, PlayerResourceHandler resources)
    {
        lives              = player.lives;
        currentObjective   = player.currentObjective;
        currentLevel       = player.currentLevel;
        currentWave        = player.currentWave;
        health             = player.health;
        fuelCount          = resources.fuelCount;
        ammoCount          = resources.ammoCount;
        openedChests       = resources.openedChestsList;
        hasOpenedStoneGate = resources.hasOpenedStoneGate;

        position    = new float[3];
        position[0] = player.transform.position.x;
        position[1] = player.transform.position.y;
        position[2] = player.transform.position.z;

        lastCheckPointPosition    = new float[3];
        lastCheckPointPosition[0] = player.lastCheckPointPosition.x;
        lastCheckPointPosition[1] = player.lastCheckPointPosition.y;
        lastCheckPointPosition[2] = player.lastCheckPointPosition.z;

        playerInventoryList = player.playerInventoryList;
    }