Exemple #1
0
    public override object Read(ES2Reader reader)
    {
        EnemyKillStat data = new EnemyKillStat();

        Read(reader, data);
        return(data);
    }
Exemple #2
0
    public override void Write(object obj, ES2Writer writer)
    {
        EnemyKillStat data = (EnemyKillStat)obj;

        // Add your writer.Write calls here.
        writer.Write(data.ScoreName);
        writer.Write(data.KillsThisSession);
        writer.Write(data.KillsLifetime);
        writer.Write(data.KillsLastSession);
    }
Exemple #3
0
    public override void Read(ES2Reader reader, object c)
    {
        EnemyKillStat data = (EnemyKillStat)c;

        // Add your reader.Read calls here to read the data into the object.
        data.ScoreName        = reader.Read <System.String>();
        data.KillsThisSession = reader.Read <System.Int32>();
        data.KillsLifetime    = reader.Read <System.Int32>();
        data.KillsLastSession = reader.Read <System.Int32>();
    }
Exemple #4
0
    public void AddKill(string enemyName)
    {
        var enemyStats = _enemyKillStats.FirstOrDefault(e => e.ScoreName == enemyName);

        if (enemyStats == null)
        {
            enemyStats = new EnemyKillStat {
                ScoreName = enemyName
            };

            _enemyKillStats.Add(enemyStats);
        }

        enemyStats.KillsLifetime++;
        enemyStats.KillsThisSession++;

        SaveEnemyKillStats();
    }