private void CreateSmallBullet(double rotation) { SingularityBullet smallBullet = new SingularityBullet(SceneMgr, IdMgr.GetNewId(SceneMgr.GetCurrentPlayer().GetId())); smallBullet.Owner = Owner; Vector dir = Direction; dir.Normalize(); smallBullet.Direction = dir.Rotate(rotation); smallBullet.Position = Center; smallBullet.Radius = 2; smallBullet.Damage = Damage / 2; PointCollisionShape cs = new PointCollisionShape(); cs.Center = smallBullet.Center; smallBullet.CollisionShape = cs; smallBullet.Color = Color; smallBullet.SetGeometry(SceneGeometryFactory.CreateConstantColorEllipseGeometry(smallBullet)); LinearMovementControl nmc = new LinearMovementControl(); nmc.Speed = GetControlOfType <LinearMovementControl>().Speed; smallBullet.AddControl(nmc); SingularityBulletCollisionReactionControl cc = new SingularityBulletCollisionReactionControl(); cc.StatReported = true; smallBullet.AddControl(cc); smallBullet.AddControl(new StickyPointCollisionShapeControl()); SceneMgr.DelayedAttachToScene(smallBullet); }
protected override ISceneObject SpawnBullet(Point point) { if (lastBullet != null) { lastBullet.GetControlOfType <HighlightingControl>().Enabled = false; } if (point.Y > Owner.GetBaseLocation().Y) { point.Y = Owner.GetBaseLocation().Y; } lastBullet = SceneObjectFactory.CreateSingularityBouncingBullet(SceneMgr, point, Owner); NetOutgoingMessage msg = SceneMgr.CreateNetMessage(); lastBullet.WriteObject(msg); SceneMgr.SendMessage(msg); HighlightingControl hc = new HighlightingControl(); lastBullet.AddControl(hc); SceneMgr.DelayedAttachToScene(lastBullet); return(lastBullet); }
private void Slow(Asteroid ast, bool exact) { IMovementControl c = ast.GetControlOfType <IMovementControl>(); LinearRotationControl c1 = ast.GetControlOfType <LinearRotationControl>(); if (c == null || c1 == null) { return; } float time = exact ? 1.5f * exactBonus : 1.5f; List <IControl> controls = new List <IControl>(); controls.Add(c); controls.Add(c1); AsteroidFreezeControl removal = new AsteroidFreezeControl(); removal.SetControlsForDisable(controls); removal.Time = time; ast.AddControl(removal); // led je posunut o pulku radiusu doleva Vector p = new Vector(ast.Position.X - (ast.Radius / 2), ast.Position.Y - (ast.Radius / 2)); // potom jeho sirka musi byt prumer + 2 * posunuti (vlevo a vpravo) => r * (2 + 0.5 + 0.5) IceSquare s = SceneObjectFactory.CreateIceSquare(SceneMgr, p, new Size(ast.Radius * 3, ast.Radius * 3)); s.AddControl(new LimitedLifeControl(time)); SceneMgr.DelayedAttachToScene(s); }
public override void StartAction(List <Asteroid> afflicted, bool exact) { int radius = 100; float lifeTime = 2; Color color = new Color(); color.A = 35; color.R = 80; color.G = 255; color.B = 80; field = SceneObjectFactory.CreateSphereField(SceneMgr, Owner.Device.Center - new Vector(radius, radius), radius, color); StaticFieldControl control = new StaticFieldControl(); control.Force = 140; control.LifeTime = lifeTime; control.Radius = radius; RippleEffectControl rippleControl = new RippleEffectControl(); rippleControl.Speed = 15; Owner.Device.AddControl(control); field.AddControl(rippleControl); field.AddControl(new LimitedLifeControl(lifeTime)); field.AddControl(new CenterCloneControl(Owner.Device)); SceneMgr.DelayedAttachToScene(field); }
protected override ISceneObject SpawnMine(Point point) { SingularityMine mine = SceneObjectFactory.CreateAsteroidDroppingSingularityMine(SceneMgr, point, Owner); Vector dir = new Vector(endPoint.X - startPoint.X, endPoint.Y - startPoint.Y); dir.Normalize(); mine.Direction = dir; LinearMovementControl c = mine.GetControlOfType <LinearMovementControl>(); c.Speed = Owner.Data.MineFallingSpeed * SharedDef.MINE_LAUNCHER_SPEED_MODIFIER; if (SceneMgr.GameType != Gametype.SOLO_GAME) { NetOutgoingMessage msg = SceneMgr.CreateNetMessage(); (mine as ISendable).WriteObject(msg); SceneMgr.SendMessage(msg); } HighlightingControl hc = new HighlightingControl(); mine.AddControl(hc); lastMine = mine; SceneMgr.DelayedAttachToScene(mine); return(mine); }
public void Start(bool send = false) { particles.Clear(); ending = false; amount = Amount; delayTime = Delay; timeLap = 0; time = 0; if (Dead) { Dead = false; SceneMgr.DelayedAttachToScene(this); } if (send) { Lidgren.Network.NetOutgoingMessage msg = SceneMgr.CreateNetMessage(); msg.Write((int)PacketType.PARTICLE_EMMITOR_CREATE); WriteMe(msg); SceneMgr.SendMessage(msg); } }
public override void OnAttach() { overlay = SceneObjectFactory.CreateAsteroidOverlay(SceneMgr, this); SceneMgr.DelayedAttachToScene(overlay); effects = SceneObjectFactory.CreateAsteroidEffects(SceneMgr, this); SceneMgr.DelayedAttachToScene(effects); }
protected virtual ISceneObject SpawnMine(Point point) { SingularityMine mine = SceneObjectFactory.CreateDroppingSingularityMine(SceneMgr, point, Owner); if (SceneMgr.GameType != Gametype.SOLO_GAME) { NetOutgoingMessage msg = SceneMgr.CreateNetMessage(); (mine as ISendable).WriteObject(msg); SceneMgr.SendMessage(msg); } SceneMgr.DelayedAttachToScene(mine); return(mine); }
private void InitNewLink(IContainsGold obj) { StretchingLineControl stretchingControl = new StretchingLineControl(); stretchingControl.FirstObj = me; stretchingControl.SecondObj = obj; Line line = new Line(sceneMgr, IdMgr.GetNewId(sceneMgr.GetCurrentPlayer().GetId()), me.Position, obj.Position, Colors.Black, 1); line.AddControl(stretchingControl); line.AddControl(new MiningLineControl()); sceneMgr.DelayedAttachToScene(line); CurrentlyMining.Add(new MiningObject(obj, line)); }
protected override ISceneObject SpawnBullet(Point point) { if (point.Y > Owner.GetBaseLocation().Y) { point.Y = Owner.GetBaseLocation().Y; } SingularityExplodingBullet bullet = SceneObjectFactory.CreateSingularityExploadingBullet(SceneMgr, point.ToVector(), Owner); NetOutgoingMessage msg = SceneMgr.CreateNetMessage(); (bullet as ISendable).WriteObject(msg); SceneMgr.SendMessage(msg); SceneMgr.DelayedAttachToScene(bullet); return(bullet); }
protected virtual ISceneObject SpawnHook(Point point) { if (point.Y > Owner.GetBaseLocation().Y - 5) { point.Y = Owner.GetBaseLocation().Y - 5; } hook = CreateHook(point); NetOutgoingMessage msg = SceneMgr.CreateNetMessage(); hook.WriteObject(msg); SceneMgr.SendMessage(msg); SceneMgr.DelayedAttachToScene(hook); return(hook); }
protected virtual ISceneObject SpawnBullet(Point point) { if (point.Y > Owner.GetBaseLocation().Y) { point.Y = Owner.GetBaseLocation().Y; } SingularityBullet bullet = SceneObjectFactory.CreateSingularityBullet(SceneMgr, point, Owner); if (SceneMgr.GameType != Gametype.SOLO_GAME) { NetOutgoingMessage msg = SceneMgr.CreateNetMessage(); (bullet as ISendable).WriteObject(msg); SceneMgr.SendMessage(msg); } SceneMgr.DelayedAttachToScene(bullet); return(bullet); }
public void Attach(SceneMgr mgr, bool send = true) { mgr.GetParticleArea().BeginInvoke(new Action(() => { list.ForEach(e => { e.Enabled = true; mgr.DelayedAttachToScene(e); if (send) { NetOutgoingMessage msg = mgr.CreateNetMessage(); e.WriteObject(msg); mgr.SendMessage(msg); } }); })); }
private void SpawnSmallMeteors(int radius) { if (SceneMgr.GetPlayer(Destroyer) == null || !SceneMgr.GetPlayer(Destroyer).IsCurrentPlayerOrBot()) { return; } int rotation = SceneMgr.GetRandomGenerator().Next(360); int textureId = SceneMgr.GetRandomGenerator().Next(1, 18); float speed = GetControlOfType <NewtonianMovementControl>().Speed / 2; MinorAsteroid a1 = SceneObjectFactory.CreateSmallAsteroid(SceneMgr, Direction, Center, rotation, textureId, radius, speed, Math.PI / 12); MinorAsteroid a2 = SceneObjectFactory.CreateSmallAsteroid(SceneMgr, Direction, Center, rotation, textureId, radius, speed, 0); MinorAsteroid a3 = SceneObjectFactory.CreateSmallAsteroid(SceneMgr, Direction, Center, rotation, textureId, radius, speed, -Math.PI / 12); a1.Parent = this; a2.Parent = this; a3.Parent = this; SceneMgr.DelayedAttachToScene(a1); SceneMgr.DelayedAttachToScene(a2); SceneMgr.DelayedAttachToScene(a3); NetOutgoingMessage message = SceneMgr.CreateNetMessage(); message.Write((int)PacketType.MINOR_ASTEROID_SPAWN); message.Write(speed); message.Write(radius); message.Write(Direction); message.Write(Center); message.Write(rotation); message.Write(textureId); message.Write(Destroyer); message.Write(a1.Id); message.Write(a2.Id); message.Write(a3.Id); message.Write(Id); SceneMgr.SendMessage(message); }