void Shell_onCollided(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (objB.ObjClass == "WarShip") { if (PurviewMgr.IsMainHost) { WarShipShell shell = Sender as WarShipShell; WarShip firer = shell.Firer as WarShip; if (objB.Script != firer.ObjInfo.Script) { (shell.Firer as WarShip).Score += SpaceWarConfig.ScoreByHit; SyncShipScoreHp(shell.Firer as WarShip, true); } } sceneMgr.DelGameObj("shell", Sender.Name); new ShellExplodeBeta(Sender.Pos, ((ShellNormal)Sender).Azi); Quake.BeginQuake(10, 50); Sound.PlayCue("EXPLO1"); } else { WarShipShell shell = (WarShipShell)Sender; shell.MirrorPath(result); // //BroadcastObjPhiStatus(shell, true); } }
void WarShip_OnShoot(WarShip firer, Vector2 endPoint, float azi) { if (PurviewMgr.IsMainHost) { WarShipShell shell = new WarShipShell("shell" + shellcount, firer, endPoint, azi); shell.onCollided += new OnCollidedEventHandler(Shell_onCollided); shell.OnOutDate += new WarShipShell.ShellOutDateEventHandler(Shell_OnOutDate); sceneMgr.AddGameObj("shell", shell); SyncCasheWriter.SubmitCreateObjMg("shell", typeof(WarShipShell), "shell" + shellcount, firer, endPoint, azi); shellcount++; } }
void SyncCasheReader_onCreateObj(IGameObj obj) { if (obj is WarShipShell) { WarShipShell shell = obj as WarShipShell; shell.onCollided += new OnCollidedEventHandler(Shell_onCollided); shell.OnOutDate += new WarShipShell.ShellOutDateEventHandler(Shell_OnOutDate); shellcount++; } else if (obj is Rock) { Rock newRock = obj as Rock; newRock.OnCollided += new OnCollidedEventHandler(Rock_OnCollided); rocks.Add(newRock); rockCount++; } }
void Shell_OnOutDate(WarShipShell sender, IGameObj shooter) { OutDateShellNames.Add(sender.Name); }