private void UpdateTimer(float second) { if (gameTotolTime > 0) { gameTotolTime -= second; } if (gameTotolTime <= 0 && PurviewMgr.IsMainHost) { SyncCasheWriter.SubmitUserDefineInfo("Over", ""); SendOverRankInfo(); isSendOver = true; //GameOver(); } }
private void SyncShipScoreHp(WarShip ship, bool subScore) { if (PurviewMgr.IsMainHost) { if (subScore) { SyncCasheWriter.SubmitUserDefineInfo("Score", "", ship, ship.Score); } else { SyncCasheWriter.SubmitUserDefineInfo("Hp", "", ship, ship.HP); } } }
private void BroadcastObjPhiStatus(IGameObj obj, bool collide) { if (obj is IPhisicalObj) { if (collide) { NonInertiasPhiUpdater phiUpdater = (NonInertiasPhiUpdater)((IPhisicalObj)obj).PhisicalUpdater; SyncCasheWriter.SubmitUserDefineInfo("ObjPhiCollide", obj.ObjInfo.ObjClass, obj, phiUpdater.Pos, phiUpdater.Vel, phiUpdater.Azi, phiUpdater.AngVel); } else { NonInertiasPhiUpdater phiUpdater = (NonInertiasPhiUpdater)((IPhisicalObj)obj).PhisicalUpdater; SyncCasheWriter.SubmitUserDefineInfo("ObjPhi", obj.ObjInfo.ObjClass, obj, phiUpdater.Pos, phiUpdater.Vel, phiUpdater.Azi, phiUpdater.AngVel); } } }
private void SetGoldNewPos(Gold Sender) { if (PurviewMgr.IsMainHost) { while (true) { Vector2 pos = RandomHelper.GetRandomVector2(0, 1); pos.X *= mapRect.Width - 200; pos.Y *= mapRect.Height - 200; pos += new Vector2(100, 100); if (CanAddObjAtPos(pos)) { Sender.Born(pos); SyncCasheWriter.SubmitUserDefineInfo("GoldBorn", "", Sender, Sender.Pos); break; } } } }
void Warship_OnDead(WarShip sender) { //sceneMgr.DelGameObj(sender.MgPath); if (PurviewMgr.IsMainHost) { while (true) { Vector2 newPos = RandomHelper.GetRandomVector2(0, 1); newPos.X *= mapRect.Width; newPos.X += mapRect.X; newPos.Y *= mapRect.Height; newPos.Y += mapRect.Y; if (CanAddObjAtPos(newPos)) { (sender as WarShip).Born(newPos); SyncCasheWriter.SubmitUserDefineInfo("WarshipBorn", "", sender, newPos); break; } } } }