您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
41 行
1.3 KiB
41 行
1.3 KiB
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
// TODO (petera) Rename this to GameModeState or something even better
|
|
|
|
// This is data is replicated to the clients about the 'global' state of
|
|
// the game mode, scores etc.
|
|
|
|
public class GameMode : MonoBehaviour, INetworkSerializable
|
|
{
|
|
public int gameTimerSeconds;
|
|
public string gameTimerMessage;
|
|
public string teamName0;
|
|
public string teamName1;
|
|
public int teamScore0;
|
|
public int teamScore1;
|
|
|
|
public void Serialize(ref NetworkWriter writer, IEntityReferenceSerializer refSerializer)
|
|
{
|
|
writer.WriteInt32("gameTimerSeconds", gameTimerSeconds);
|
|
writer.WriteString("gameTimerMessage", gameTimerMessage);
|
|
|
|
writer.WriteString("teamName0", teamName0);
|
|
writer.WriteString("teamName1", teamName1);
|
|
writer.WriteInt32("teamScore0", teamScore0);
|
|
writer.WriteInt32("teamScore1", teamScore1);
|
|
}
|
|
|
|
public void Deserialize(ref NetworkReader reader, IEntityReferenceSerializer refSerializer, int tick)
|
|
{
|
|
gameTimerSeconds = reader.ReadInt32();
|
|
gameTimerMessage = reader.ReadString();
|
|
|
|
teamName0 = reader.ReadString();
|
|
teamName1 = reader.ReadString();
|
|
teamScore0 = reader.ReadInt32();
|
|
teamScore1 = reader.ReadInt32();
|
|
}
|
|
}
|