public IGameObj CreateInstance(Vector2 pos) { IGameObj result = CreateInstance(); result.Pos = pos; return(result); }
void phiUpdater_OnOverlap(IGameObj sender, CollisionResult result, GameObjInfo objB) { if (OnOverlap != null) { OnOverlap(this, result, objB); } }
public void SetObj(IGameObj obj) { this.obj = obj; this.properityList = new ProperityList(obj); this.DataSource = properityList.List; }
public ProperityList(IGameObj obj) { this.obj = obj; list = new List <Element>(); UpdateList(); }
void phisicalUpdater_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (OnOverLap != null) { InfoRePath.CallEvent(this.mgPath, "OnOverlap", OnOverLap, this, result, objB); } }
public void CallOnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (OnOverLap != null) { OnOverLap(Sender, result, objB); } }
public void CallOnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (OnCollied != null) { OnCollied(Sender, result, objB); } }
void phiUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (onCollided != null) { onCollided(this, result, objB); } }
void phisicalUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (OnCollied != null) { InfoRePath.CallEvent(this.mgPath, "OnCollied", OnCollied, this, result, objB); } }
void WarShip_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (objB.ObjClass == "WarShipShell") { WarShip ship = (WarShip)Sender; ship.BeginStill(); if (PurviewMgr.IsMainHost) { ship.HitByShell(); } ship.Vel = result.NormalVector * SpaceWarConfig.ShellSpeed; SyncShipScoreHp(ship, false); } else if (objB.ObjClass == "WarShip") { WarShip ship = (WarShip)Sender; Vector2 newVel = CalMirrorVel(ship.Vel, result.NormalVector); ship.Vel = newVel; ship.BeginStill(); } else if (objB.ObjClass == "Rock") { WarShip ship = (WarShip)Sender; Vector2 newVel = CalMirrorVel(ship.Vel, result.NormalVector); ship.Vel = newVel; ship.BeginStill(); } }
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); } }
public ProperityList ( IGameObj obj ) { this.obj = obj; list = new List<Element>(); UpdateList(); }
public string doJudge(string param1, string param2) { rock = new RockWin(); paper = new PaperWin(); scissors = new ScissorsWin(); draw = new DrawGame(); rock.next = paper; paper.next = scissors; scissors.next = draw; result = rock.doWin(param1, param2); return result; // Let's try to leave this kind of practice away... // Vamos tentar deixar esse tipo de prática de lado... //if (param1 == param2) //{ // return "Draw"; //} //if (param1 == "Rock" && param2 == "Paper") //{ // return "Rock wins."; //} //if (param1 == "Rock" && param2 == "Scissors") //{ // return "Scissors wins."; //} }
// Kershove! public override void OnCollide(IGameObj o, GameState g) { Vector2d force = Vector2d.NormalizeFast(Vel); force = Vector2d.Multiply(force, 300); o.Push(force); base.OnCollide(o, g); }
void Shell_onOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (objB.ObjClass == "Border") { NiceShootSum = Math.Max(0, NiceShootSum - 10); } //camera.Focus( tank ); }
void phiUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (onCollided != null) { //onCollided( this, result, objB ); InfoRePath.CallEvent(this.MgPath, "onCollided", onCollided, this, result, objB); } }
public ObjDisplay(string name, Type objClassType, string objDataPath) { this.name = name; this.objClassType = objClassType; this.objDataPath = objDataPath; example = CreateInstance(); }
void phiUpdater_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (onOverlap != null) { //onOverlap( this, result, objB ); InfoRePath.CallEvent(this.MgPath, "onOverlap", onOverlap, this, result, objB); } }
void shell_onCollided(IGameObj Sender, CollisionResult result, GameObjInfo objB) { sceneMgr.DelGameObj("shell", Sender.Name); new ShellExplodeBeta(Sender.Pos, ((ShellNormal)Sender).Azi); Quake.BeginQuake(10, 50); Sound.PlayCue("EXPLO1"); }
public ObjDisplay ( string name, Type objClassType, string objDataPath ) { this.name = name; this.objClassType = objClassType; this.objDataPath = objDataPath; example = CreateInstance(); }
void SyncCasheReader_onCreateObj(IGameObj obj) { if (obj is ShellNormal) { ShellNormal shell = obj as ShellNormal; shell.onCollided += new OnCollidedEventHandler(shell_onCollided); shellSum++; } }
public ShellNormal(string name, IGameObj firer, Vector2 startPos, float startAzi, float speed) { this.name = name; this.firer = firer; sprite = new Sprite(BaseGame.RenderEngine, BaseGame.ContentMgr, Path.Combine(Directories.ContentDirectory, texPath), true); sprite.SetParameters(new Vector2(5, 0), startPos, 0.08f, startAzi, Color.White, LayerDepth.Shell, SpriteBlendMode.AlphaBlend); phiUpdater = new NonInertiasColUpdater(ObjInfo, startPos, MathTools.NormalVectorFromAzi(startAzi) * speed, startAzi, 0f, new Sprite[] { sprite }); phiUpdater.OnOverlap += new OnCollidedEventHandler(phiUpdater_OnOverlap); phiUpdater.OnCollied += new OnCollidedEventHandler(phiUpdater_OnCollied); }
public ShellNormal( string name, IGameObj firer, Vector2 startPos, float startAzi, float speed ) { this.name = name; this.firer = firer; sprite = new Sprite( BaseGame.RenderEngine, BaseGame.ContentMgr, Path.Combine( Directories.ContentDirectory, texPath ), true ); sprite.SetParameters( new Vector2( 5, 0 ), startPos, 0.08f, startAzi, Color.White, LayerDepth.Shell, SpriteBlendMode.AlphaBlend ); phiUpdater = new NonInertiasColUpdater( ObjInfo, startPos, MathTools.NormalVectorFromAzi( startAzi ) * speed, startAzi, 0f, new Sprite[] { sprite } ); phiUpdater.OnOverlap += new OnCollidedEventHandler( phiUpdater_OnOverlap ); phiUpdater.OnCollied += new OnCollidedEventHandler( phiUpdater_OnCollied ); }
void phiUpdater_OnOverlap( IGameObj Sender, CollisionResult result, GameObjInfo objB ) { //if (objB.ObjClass == "Border") //{ // ((SceneKeeperCommon)(GameManager.CurSceneKeeper)).RemoveGameObj( this, true, false, false, false, SceneKeeperCommon.GameObjLayer.lowFlying ); //} if (onOverlap != null) onOverlap( this, result, objB ); }
void Warship_OnOverLap(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (objB.ObjClass == "Gold") { WarShip ship = Sender as WarShip; ship.Score += SpaceWarConfig.GoldScore; SyncShipScoreHp(ship, true); } }
public bool Colliding(IGameObj o) { if (Collidable && o.Collidable) { return(Collider.Colliding(o.Collider)); } else { return(false); } }
public override bool Colliding(IGameObj o) { if (o.Shootable) { return(base.Colliding(o)); } else { return(false); } }
public override bool Colliding(IGameObj o) { if (LifeTime < 5) { return(false); } else { return(base.Colliding(o)); } }
void Shell_onCollided(IGameObj Sender, CollisionResult result, GameObjInfo objB) { //scene.RemoveGameObj( Sender, true, false, false, false, SceneKeeperCommon.GameObjLayer.lowFlying ); sceneMgr.DelGameObj("shell", Sender.Name); //camera.Focus( tank ); //if (objB.Name == "Border") //{ // NiceShootSum = Math.Max( 0, NiceShootSum - 1 ); //} }
void controller_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (onCollide != null) { onCollide(this, result, objB); } if (OnCollide != null) { OnCollide(result, objB); } }
public void Boundary(IGameObj o) { double dist = o.Loc.Length; double f = dist - Radius; if (f > 0) { Vector2d pos = o.Loc; pos.Normalize(); o.Push(Vector2d.Multiply(pos, -(dist / 100))); // And bounce them back. } }
void phiUpdater_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB) { //if (objB.ObjClass == "Border") //{ // ((SceneKeeperCommon)(GameManager.CurSceneKeeper)).RemoveGameObj( this, true, false, false, false, SceneKeeperCommon.GameObjLayer.lowFlying ); //} if (onOverlap != null) { onOverlap(this, result, objB); } }
void controller_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (onOverLap != null) { onOverLap(this, result, objB); } if (OnOverLap != null) { OnOverLap(result, objB); } }
/// <summary> /// 添加物体 /// </summary> /// <param name="groupPath">要添加到的组的路径,该组必须为TypeGroup</param> /// <param name="obj"></param> /// <returns></returns> public bool AddGameObj(string groupPath, IGameObj obj) { Group fatherGroup = FindGroup(groupPath); if (fatherGroup != null && fatherGroup is TypeGroup) { return((fatherGroup as TypeGroup).AddObj(obj)); } else { return(false); } }
void controller_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (onCollide != null) { //onCollide(this, result, objB); InfoRePath.CallEvent(this.MgPath, "onCollide", onCollide, this, result, objB); } if (OnCollide != null) { //OnCollide(result, objB); InfoRePath.CallEvent(this.MgPath, "OnCollide", OnCollide, result, objB); } }
public ShellNormal(string name, IGameObj firer, Vector2 startPos, float startAzi, float speed, string texPath, bool fromContent, Vector2 texOrignPos, float texScale) { this.name = name; this.firer = firer; if (fromContent) { sprite = new Sprite(BaseGame.RenderEngine, BaseGame.ContentMgr, texPath, true); } else { sprite = new Sprite(BaseGame.RenderEngine, texPath, true); } sprite.SetParameters(texOrignPos, startPos, texScale, startAzi, Color.White, LayerDepth.Shell, SpriteBlendMode.AlphaBlend); phiUpdater = new NonInertiasColUpdater(ObjInfo, startPos, MathTools.NormalVectorFromAzi(startAzi) * speed, startAzi, 0f, new Sprite[] { sprite }); phiUpdater.OnOverlap += new OnCollidedEventHandler(phiUpdater_OnOverlap); phiUpdater.OnCollied += new OnCollidedEventHandler(phiUpdater_OnCollied); }
void phisicalUpdater_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (OnOverLap != null) InfoRePath.CallEvent(this.mgPath, "OnOverlap", OnOverLap, this, result, objB); }
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++; } }
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); } } }
void Gold_OnOverLap(IGameObj Sender, CollisionResult result, GameObjInfo objB) { SetGoldNewPos(Sender as Gold); }
void Rock_OnCollided(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (objB.ObjClass == "WarShip")// || objB.ObjClass == "Rock") { Vector2 newVel = CalMirrorVel((Sender as Rock).Vel, result.NormalVector); (Sender as Rock).Vel = newVel; } else if (objB.ObjClass == "Rock") { Vector2 newVel = CalMirrorVel((Sender as Rock).Vel, result.NormalVector); (Sender as Rock).Vel = newVel; } //BroadcastObjPhiStatus(Sender, true); }
public SmokeGenerater( float duaration, float partiDuara, Vector2 dir, float speed, float concen, bool managered, IGameObj foucsObj ) : this( duaration, partiDuara, Vector2.Zero, dir, speed, concen, managered ) { this.foucsObj = foucsObj; }
void Shell_OnOutDate(WarShipShell sender, IGameObj shooter) { OutDateShellNames.Add(sender.Name); }
public void ClearObj () { this.obj = null; this.properityList = null; }
void shell_onCollided( IGameObj Sender, CollisionResult result, GameObjInfo objB ) { sceneMgr.DelGameObj( "shell", Sender.Name ); new ShellExplodeBeta( Sender.Pos, ((ShellNormal)Sender).Azi ); Quake.BeginQuake( 10, 50 ); Sound.PlayCue( "EXPLO1" ); }
public void SetObj ( IGameObj obj ) { this.obj = obj; this.properityList = new ProperityList( obj ); this.DataSource = properityList.List; }
void controller_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (onCollide != null) //onCollide(this, result, objB); InfoRePath.CallEvent(this.MgPath, "onCollide", onCollide, this, result, objB); if (OnCollide != null) //OnCollide(result, objB); InfoRePath.CallEvent(this.MgPath, "OnCollide", OnCollide, result, objB); }
void controller_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (onOverLap != null) //onOverLap(this, result, objB); InfoRePath.CallEvent(this.MgPath, "onOverLap", onOverLap, this, result, objB); if (OnOverLap != null) //OnOverLap(result, objB); InfoRePath.CallEvent(this.MgPath, "OnOverLap", OnOverLap, result, objB); }
public void CallOnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (OnOverLap != null) OnOverLap(Sender, result, objB); }
void WarShip_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (objB.ObjClass == "WarShipShell") { WarShip ship = (WarShip)Sender; ship.BeginStill(); if (PurviewMgr.IsMainHost) ship.HitByShell(); ship.Vel = result.NormalVector * SpaceWarConfig.ShellSpeed; SyncShipScoreHp(ship, false); } else if (objB.ObjClass == "WarShip") { WarShip ship = (WarShip)Sender; Vector2 newVel = CalMirrorVel(ship.Vel, result.NormalVector); ship.Vel = newVel; ship.BeginStill(); } else if (objB.ObjClass == "Rock") { WarShip ship = (WarShip)Sender; Vector2 newVel = CalMirrorVel(ship.Vel, result.NormalVector); ship.Vel = newVel; ship.BeginStill(); } }
public void CallOnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (OnCollied != null) OnCollied(Sender, result, objB); }
void phiUpdater_OnCollied( IGameObj Sender, CollisionResult result, GameObjInfo objB ) { if (onCollided != null) onCollided( this, result, objB ); }
void phisicalUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (OnCollied != null) InfoRePath.CallEvent(this.mgPath, "OnCollied", OnCollied, this, result, objB); }
void phiUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (onCollided != null) //onCollided( this, result, objB ); InfoRePath.CallEvent(this.MgPath, "onCollided", onCollided, this, result, objB); }
public ShellNormal(string name, IGameObj firer, Vector2 startPos, float startAzi, float speed) : this(name, firer, startPos, startAzi, speed, "GameObjs\\ShellNormal", true, new Vector2(5, 0), 0.08f) { }
public void RemoveGameObj ( IGameObj obj, bool asPhi, bool asShe, bool asRaderOwner, bool asEyeable, GameObjLayer layer ) { if (obj == null) throw new NullReferenceException( "GameObj is null!" ); if (asPhi && !(obj is IPhisicalObj)) throw new Exception( "obj isn't a IPhisicalObj!" ); if (!(obj is ICollideObj)) throw new Exception( "obj isn't a ICollideObj!" ); if (asShe && !(obj is IShelterObj)) throw new Exception( "obj isn't a IShelterObj!" ); if (asRaderOwner && !(obj is IRaderOwner)) throw new Exception( "obj isn't a IRaderOwner!" ); if (asEyeable && !(obj is IEyeableObj)) throw new Exception( "obj isn't a IEyeableObj!" ); SenceObjs.Remove( obj ); if (asPhi) phisicalObjs.Remove( (IPhisicalObj)obj ); if (asShe) tankRaderShelters.Remove( (IShelterObj)obj ); if (asRaderOwner) tankRaderOwners.Remove( (IRaderOwner)obj ); if (layer == GameObjLayer.Convace) concaveObjs.Remove( (ICollideObj)obj ); else if (layer == GameObjLayer.LowBulge) lowBulgeObjs.Remove( (ICollideObj)obj ); else if (layer == GameObjLayer.HighBulge) highBulgeObjs.Remove( (ICollideObj)obj ); else if (layer == GameObjLayer.lowFlying) lowFlyingObjs.Remove( (ICollideObj)obj ); else if (layer == GameObjLayer.highFlying) highFlyingObjs.Remove( (ICollideObj)obj ); if (asEyeable) { visibleObjs.Remove( (IEyeableObj)obj ); } }
void phiUpdater_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB) { if (onOverlap != null) //onOverlap( this, result, objB ); InfoRePath.CallEvent(this.MgPath, "onOverlap", onOverlap, this, result, objB); }
void tank_onCollide( IGameObj Sender, CollisionResult result, GameObjInfo objB ) { if (objB.ObjClass == "ShellNormal") { if (Sender == tank1) { tank1.Live--; // 在此添加效果 tank1.smoke.Concen += 0.2f; if (tank1.Live <= 0 && !tank1.IsDead) { new Explode( tank1.Pos, 0 ); tank1.Dead(); new GameTimer( 3, delegate() { MessageBox.Show( "Tank2胜利!" ); gameOver = true; } ); } } else if (Sender == tank2) { tank2.Live--; tank2.smoke.Concen += 0.2f; // 在此添加效果 if (tank2.Live <= 0 && !tank2.IsDead) { new Explode( tank2.Pos, 0 ); tank2.Dead(); new GameTimer( 3, delegate() { MessageBox.Show( "Tank1胜利!" ); gameOver = true; } ); } } } }