碰碰车2.0
2017-06-14 11:07:55 1 举报
2
作者其他创作
大纲/内容
BaseSceneObject(继承Networkbehaviour)场景物体基类
[SerializeField] private AudioClip BornSound; //出生声音 [SerializeField] private AudioClip TriggerSound; //触发声音 [SerializeField] private GameObject BornParticle; //出生特效 [SerializeField] private GameObject TriggerParticle; //触发特效 protected uint ownerId; //所属者
public void SetOwnerId(uint ownerid) { this.ownerId = ownerid; } protected virtual void Init() { } protected virtual void OnRespawn() { } protected virtual void RegisterSoundAndObjects() { } protected virtual void TriggerEnter(Collider collider) { } protected virtual void BornEffect(){} protected virtual void TriggerEffect(){}
protected float intervalTime; //间隔时间protected float lastTime; //最后的时间
public override bool Tick()
CustomVector
public float X; public float Y; public float Z;
CreatureManager(生物管理:单例服务器)
private List EnemyList;
public void AddEnemy(Enemy pEnemy){ //记得NetworkServer.Spawn();}public void RemoveEnemy(uint id)(){ //记得NetworkServer.Destroy();}public Enemy GetEnemy(uint id){};public void ClearAll(){};
SpwanManager(继承Monobehaviour的单例)
Story(继承:MonoBehaviour)
[SerializeField] private StoryId id; //故事id [SerializeField] protected List myEventMap; //事件列表
//事件模板 IEnumerator EventTemplate(object value) //进入 protected virtual void Enter(); //离开 protected virtual void Exit()
VariableConfig
public CustomVector CameraVector; //摄像机位置 public CustomEulerAngles CameraAngles; //摄像机旋转
FirstPersonMode(继承:ObserverMode)
CanvasManager(继承:MonoBehaviour单例,画布管理器)
//初始化void Init();//打开面板public void OpenPlane(string name);//关闭面板public void ClosePlane(string name)//获得面板public T GetPlane(string name)
Enemy(继承Networkbehaviour)
public const int MaxHp = 100; private BehaviorTree tree; private NavMeshAgent navMeshAgent; private Animator animator; [SyncVar(hook =\"OnHpChange\")] private int hp; [SyncVar] private Vector3 syncPosition; [SyncVar] private Quaternion syncRotation; private int skillId;
public void CmdComputeHp(int hp){}
GameInfo(游戏信息)
public static ServerType ServerType; //服务器类型
//触发 public void Trigger(int id)
TopPlane(观察者)
观察者模式下 查看 所有玩家 比赛积分的排行榜
PlayerManager(单例)
private static PlayerManager instance; private List playerList = new List(); //玩家列表 private List playerInfoList = new List(); public List modelList = new List(); //模型名列表 public SyncListUInt idList = new SyncListUInt();
public void AddPlayer(CarPalyer Player){}public void RemovePlayer(uint Playerid){}public GameObject CreatePlayer(int carnumber){}public CarPlayer GetPlayer(uint netid){};public CarPlayer GetBindPlayer(int bindid);public bool IsPlayer(uint id){}public List GetAllPlayer(){};public List GetAllPlayerTransform();public void ClearAll(){};public void SendToAllPower();public void ClearPower()public T ClientGetObject(uint netId)public uint GetWinPlayer()public List ClientGetAllPlayer()
MessageCode(自定义消息id)
public const short CarInfo = 10030; public const short GameOver = 10031; public const short ListenPlayerConnect = 10032; public const short Suprise = 10050; //惊喜迷雾 public const short Story = 10051; //剧情消息 //9段位系统命令 public const short EyeRecenter = 10090; //眼睛复位
StoryEventInfo
public float Time; public string EventName;
TimerManager(继承:MonoBehaviour单例,计时器管理)
private List runtime = new List(); //运行时计时器private List end = new List(); //已经结束的计时器
BaseItem(继承BaseSceneObject(抽象类abstract))
[SerializeField] private float RecycleTime; //回收时间
DataCenter(静态)
public static NetWorkConfig NetWorkConfig; //存贮Json的客户端的配置 public static GameConfig GameConfig; //存储Josn的游戏配置 public static VariableConfig VariableConfig; //存储json的可在游戏中更改的配置文件
public static void InitJson();public static NetworkType GetNetworkType();public static void SetNetworkType(NetworkType type);
NetMessageFrame(继承NetworkBehaviour)
[SerializeField]private AudioClip GameOverSound;private bool isMatching = false;
GameManager(继承NetworkManager:服务器客户端共用)
private int GameTime; //游戏时间 private bool isConnect = false; //是否连接成功 private bool isMatch = false; //是否开始比赛 private float stopSpawnTime = 3; //停止繁殖时间 public delegate void Count(int time); public event Count EventCountDown;
ServerPanel(服务器)
Suprise(基类)
protected int id;
public abstract void Enter(); public abstract void Execute(bool isEnable); public abstract void Exit();
Timer(普通计时器)
protected uint id; //id标示protected float length; //计时长度protected Action callBack; //回调protected float startTime; //开始时间 protected bool isEnd; //是否结束了
public virtual bool Tick()
Observer(观察者:NetworkBehaviour)
private ObserverMode observerMode;
CustomEulerAngles
GameConfig
public int GameTime; public float CarScale;
ItemUseType(enum)
TimerHelper(帮助类)
private static uint curTimerId = 0; //当前计时器的id
//分配idpublic static uint AllocationID
CarPlayer(继承Networkbehaviour)
ObserverMode
SurroundMode(继承:ObserverMode)
TrackerTools(位置追踪工具)
private static string Ip = \"\";
//获得位置public static Vector3 GetPosition(int trackerId);//获得旋转 public static Quaternion GetQutation(int trackerId)//获得ippublic static string GetIp()
Engine(继承Monobehaviour:引擎驱动器)
[SerializeField]1 private ServerType type; 服务类型
private IEnumerator DelayLaunch(); 延迟启动private void LaunchClient(); 启动客户端1private void LaunchServer(); 启动服务器
ServerType(枚举)
ClientPlane(方便客户端修改:车名,服务器ip,编号的UI)
BaseBuff(继承BaseSceneObject)
AudienceMode(继承:ObserverMode)
GodMode(继承:ObserverMode)
ListenScene(继承:MonoBehaviour,场景监听)
主要负责 客户端服务器 区分的操作:1.0 比如 ART场景叠加
NetWorkConfig
public NetworkType NetworkType; public string ServerName; public string ServerIp; public int Port; public int BindId; public bool IsUseTestServer;
FogSuprise(继承:Suprise)
public override void Enter(); public override void Execute(bool isEnable); public override void Exit();
GenerateManager(单例:服务器)
[SerializeField] private Vector2 itemTimeRange; //物品随机时间区间 [SerializeField] private Vector2 itemNumRange; //物品随机个数区间 [SerializeField] private Vector2 enemyTimeRange; //敌人随机时间区间 [SerializeField] private Vector2 enemyNumRange; //敌人随机个数区间 [SerializeField] private List randomItemInfos = new List(); //随机道具信息 private List otherItemNames = new List(); private List ItemNames; //物品的名称列表 private List EnemyNames; //敌人的名称列表 private float spawnItemTimer; //道具计时器 private float spawnEnemyTimer; //敌人计时器 private SpawnType type; //生成类型 private bool isSpawing; private RandomPickOutsidePlayers RP;
SupriseManager(继承:MonoBehaviour单例,惊喜管理)
private List supriseList = new List(); //惊喜列表 private float durationTime; //间隔时间 private float lastTime = 0; //最后记录的时间 private bool IsExcuting = false; //是否在执行中 private Action OnCheck; //检查中 private Suprise curSuprise; //当前的执行中的惊喜 [SerializeField] private Vector2 randomWaitTime; //随机时间的区间 [SerializeField] private Vector2 randomDurationTime; //随机持续时间
ItemManager(单例,道具管理(服务器))
private List ItemList;
public void AddItem(BaseItem pItem){ //记得NetworkServer.Spawn();};public void RemoveItem(uint itemid){ //最后记得NetworkServer.Deatroy();};public BaseItem GetItem(uint netId){}public void Clear() ;
//执行public virtual void Execute(uint ownerId)
0 条评论
下一页