public override void DoAfterDead(ObjectBase killer, ObjectDeadType deadType) { if (Owner.DrawObject == DrawNull.Value || (DeadType & deadType) != deadType) { return; } double angle = Function.GetAngle(0, 0, Owner.MoveObject.MoveX, Owner.MoveObject.MoveY); for (int i = 0; i < ScrapCount; i++) { int speed = Global.Rand.Next(ScrapSpeedMin, Math.Max(ScrapSpeedMin, ScrapSpeedMax)); int fadeTime = Global.Rand.Next(ScrapLifeMin, Math.Max(ScrapLifeMin, ScrapLifeMax)); double scrapDirection = angle + (Global.Rand.NextDouble() - 0.5) * Radiation; MoveStraight moveObject = new MoveStraight(null, 1, speed, 1, 0, 1); moveObject.Target.SetOffsetByAngle(scrapDirection, 1000); ObjectSmoke newObject; if (ScrapDrawObject == null) { newObject = new ObjectSmoke(Owner.Layout.CenterX, Owner.Layout.CenterY, ScrapWidth, ScrapHeight, fadeTime, 1, 0, Owner.DrawObject.MainColor, moveObject); } else { DrawBase scrapDraw = ScrapDrawObject.Copy(); scrapDraw.Angle = Global.Rand.Next(360); newObject = new ObjectSmoke(Owner.Layout.CenterX, Owner.Layout.CenterY, ScrapWidth, ScrapHeight, fadeTime, 1, 0, scrapDraw, moveObject); newObject.Propertys.Add(new PropertyRotate(-1, Global.Rand.Next(280, 520), false, true)); } moveObject.Target.SetObject(newObject); Owner.Container.Add(newObject); } base.DoAfterDead(killer, deadType); }
/// <summary> /// 技能生效 /// </summary> public override void DoBeforeAction() { switch (Status) { case SkillStatus.Enabled: { if (Owner == null) { Break(); return; } Owner.Skills.AllBreak(); _OwnerSpeed = Owner.MoveObject.Speed; Owner.MoveObject.Speed = 0; Status = SkillStatus.Channeled; _MiniBar = new PropertyUI(-1, new Size(30, 6), new DrawUICounterBar(Color.FromArgb(80, 210, 140), Color.Black, Color.White, 1, true, Channeled)); Owner.Propertys.Add(_MiniBar); } break; case SkillStatus.Channeled: int getEnergy = (int)(GetEnergyPerSec / Scene.SceneRoundPerSec + 0.5F); Owner.Energy.Value += getEnergy; if (Animation.IsFull) { MoveStraight moveZZZ = new MoveStraight(null, 1, 150, 3, 100, 1F); DrawCustom drawZZZ = new DrawCustom(); drawZZZ.Colors.SetColor("Main", Color.DarkGreen); drawZZZ.AfterDraw += (x, g, r) => { Pen pen = drawZZZ.Colors.GetPen("Main"); Point[] drawPots = { new Point(r.Left, r.Top), new Point(r.Left + r.Width, r.Top), new Point(r.Left, r.Top + r.Height), new Point(r.Left + r.Width, r.Top + r.Height) }; g.DrawLines(pen, drawPots); }; ObjectSmoke objectZZZ = new ObjectSmoke(Owner.Layout.CenterX, Owner.Layout.CenterY, 4, 4, Scene.Sec(1), 3F, 0, drawZZZ, moveZZZ); moveZZZ.Target.SetOffsetByAngle(315 + Global.Rand.Next(-20, 20), 50); moveZZZ.Target.SetObject(objectZZZ); Owner.Container.Add(objectZZZ); Animation.Value = 0; } Animation.Value += Scene.SceneIntervalOfRound; break; } base.DoBeforeAction(); }
public override void DoAfterAction() { if (ScrapDrawObject == null && Owner.DrawObject == DrawNull.Value) { return; } if (BuildTime.IsFull) { for (int i = 0; i < ScrapCount; i++) { int speed = Global.Rand.Next(ScrapSpeedMin, Math.Max(ScrapSpeedMin, ScrapSpeedMax) + 1); int life = Global.Rand.Next(ScrapLifeMin, Math.Max(ScrapLifeMin, ScrapLifeMax) + 1); double scrapDirection = Global.Rand.NextDouble() * 360; MoveStraight moveObject = new MoveStraight(null, 1, speed, 1, 0, 1); moveObject.Target.SetOffsetByAngle(scrapDirection, 1000); ObjectSmoke newObject; if (ScrapDrawObject == null) { newObject = new ObjectSmoke(Owner.Layout.CenterX, Owner.Layout.CenterY, ScrapWidth, ScrapHeight, life, 1, 0, Owner.DrawObject.MainColor, moveObject); } else { DrawBase scrapDraw = ScrapDrawObject.Copy(); scrapDraw.Angle = Global.Rand.Next(360); newObject = new ObjectSmoke(Owner.Layout.CenterX, Owner.Layout.CenterY, ScrapWidth, ScrapHeight, life, 1, 0, scrapDraw, moveObject); newObject.Propertys.Add(new PropertyRotate(-1, Global.Rand.Next(280, 520), false, true)); } moveObject.Target.SetObject(newObject); Owner.Container.Add(newObject); } BuildTime.Value = 0; } else { BuildTime.Value += Scene.SceneIntervalOfRound; } base.DoAfterAction(); }
protected override void OnAfterAction() { switch (_Mode) { case 1: if (_CommandBack.DrawObject.Colors.Opacity < 1) { _CommandBack.DrawObject.Colors.Opacity += 0.05F; } if (_BackDrak < 1) { _BackDrak += 0.05F; if (_BackDrak > 1) { _BackDrak = 1; } DrawObject.Colors.RFix = DrawObject.Colors.GFix = DrawObject.Colors.BFix = -_BackDrak * 1F; for (int i = 0; i < BackObjects.Count; i++) { BackObjects[i].DrawObject.Colors.RFix = BackObjects[i].DrawObject.Colors.GFix = _BackDrak * 1F; } } break; case 0: if (_CommandBack.DrawObject.Colors.Opacity > 0) { _CommandBack.DrawObject.Colors.Opacity -= 0.1F; if (_CommandBack.DrawObject.Colors.Opacity <= 0) { _CommandBack.Visible = false; } } if (_BackDrak > 0) { _BackDrak -= 0.05F; if (_BackDrak < 0) { _BackDrak = 0; } DrawObject.Colors.RFix = DrawObject.Colors.GFix = DrawObject.Colors.BFix = -_BackDrak * 1F; for (int i = 0; i < BackObjects.Count; i++) { BackObjects[i].DrawObject.Colors.RFix = BackObjects[i].DrawObject.Colors.GFix = _BackDrak * 1F; } } break; } if (_BackBuildCounter.IsFull) { int Size = Global.Rand.Next(2, 5); int top = Layout.Rectangle.Top + Global.Rand.Next(5, Layout.RectHeight - 10); MoveStraight moveObject = new MoveStraight(null, 1, Size * Global.Rand.Next(120, 180) - 80, 1, 100, 0); ObjectSmoke newObject = new ObjectSmoke(-10, top, Size, Size, -1, 1, 1, Color.FromArgb(50, 50, 50), moveObject); newObject.DrawObject.Colors.RFix = newObject.DrawObject.Colors.GFix = _BackDrak * 1F; moveObject.Target.SetObject(newObject); moveObject.Target.SetOffsetByXY(1000, 0); moveObject.Resistance = Mode == 1 ? 10 : 1; BackObjects.Add(newObject); _BackBuildCounter.Value = 0; } else { _BackBuildCounter.Value += Scene.IntervalOfRound; } base.OnAfterAction(); }
public override void DoAfterDead(ObjectBase killer, ObjectDeadType deadType) { if ((DeadType & deadType) != deadType) { return; } if (SharkPower > 0) { Scene.EffectObjects.Add(new EffectShark(Scene.Sec(0.2F), SharkPower)); } int explosionSize = (int)(RangeMultiple * (Owner.Layout.RectWidth + Owner.Layout.RectHeight) / 2) + RangeConstant; ObjectSmoke explosionObject = new ObjectSmoke(Owner.Layout.CenterX, Owner.Layout.CenterY, explosionSize, explosionSize, Scene.Sec(0.6F), 0.9F, 0, Color, MoveNull.Value); Owner.Container.Add(explosionObject); for (int i = 0; i < Owner.Container.Count; i++) { ObjectBase objectBase = Owner.Container[i]; if (objectBase.Status != ObjectStatus.Alive || Function.IsFriendly(objectBase.League, CollisionLeague)) { continue; } // 特殊狀態判定 具碰撞 非鬼魂 if ((objectBase.Propertys.Affix & SpecialStatus.Collision) != SpecialStatus.Collision || (objectBase.Propertys.Affix & SpecialStatus.Ghost) == SpecialStatus.Ghost) { continue; } // 碰撞判定 if (!Function.IsCollison(objectBase.Layout, explosionObject.Layout)) { continue; } // 檢查目標有無碰撞特性 int colliderPower = -1; for (int j = 0; j < objectBase.Propertys.Count; j++) { PropertyCollision checkCollision = objectBase.Propertys[j] as PropertyCollision; if (checkCollision != null && checkCollision.Status == PropertyStatus.Enabled) { colliderPower = Math.Max(colliderPower, checkCollision.CollisionPower); } } if (colliderPower < 0) { continue; } if (colliderPower <= CollisionPower) { objectBase.Kill(Owner, ObjectDeadType.Collision); } } base.DoAfterDead(killer, deadType); }
public override void DoAfterDead(ObjectBase killer, ObjectDeadType deadType) { if (Owner.DrawObject == DrawNull.Value || (DeadType & deadType) != deadType) { return; } double angle = Function.GetAngle(0, 0, Owner.MoveObject.MoveX, Owner.MoveObject.MoveY); DrawBase drawObject = Owner.DrawObject; Rectangle baseRectangle = Owner.Layout.Rectangle; Rectangle drawRectangle; if (drawObject.Scale > 1) { drawRectangle = drawObject.GetScaleRectangle(baseRectangle); baseRectangle.Location.Offset(-drawRectangle.Location.X, -drawRectangle.Location.Y); drawRectangle.Location = new Point(0, 0); } else { baseRectangle.Location = new Point(0, 0); drawRectangle = baseRectangle; } List <Point> getPoints = new List <Point>(); using (Bitmap image = new Bitmap(drawRectangle.Width, drawRectangle.Height)) using (Graphics g = Graphics.FromImage(image)) { Owner.DrawObject.Draw(g, baseRectangle); BitmapData bitData = image.LockBits(drawRectangle, System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); IntPtr scan0 = bitData.Scan0; unsafe { byte *p = (byte *)scan0.ToPointer(); for (int y = 0; y < drawRectangle.Height; y++) { for (int x = 0; x < drawRectangle.Width; x++) { if (p[3] > 0) { getPoints.Add(new Point(x, y)); } p += 4; } } } image.UnlockBits(bitData); if (getPoints.Count == 0) { return; } int idxPlus = ((getPoints.Count - 1) / ScrapCount) + 1; int idx = Global.Rand.Next(idxPlus); for (int i = 0; i < ScrapCount; i++) { Point point = getPoints[idx]; PointF putPoint = new PointF(Owner.Layout.CenterX - (drawRectangle.Width / 2) + point.X, Owner.Layout.CenterY - (drawRectangle.Height / 2) + point.Y); int speed = Global.Rand.Next(ScrapSpeedMin, Math.Max(ScrapSpeedMin, ScrapSpeedMax)); int fadeTime = Global.Rand.Next(ScrapLifeMin, Math.Max(ScrapLifeMin, ScrapLifeMax)); double scrapDirection = angle + (Global.Rand.NextDouble() - 0.5) * Radiation; MoveStraight moveObject = new MoveStraight(null, 1, speed, 1, 0, 1); moveObject.Target.SetOffsetByAngle(scrapDirection, 1000); ObjectSmoke newObject; if (ScrapDrawObject == null) { Color drawColor = image.GetPixel(point.X, point.Y); newObject = new ObjectSmoke(putPoint.X, putPoint.Y, ScrapWidth, ScrapHeight, fadeTime, 1, 0, drawColor, moveObject); } else { DrawBase scrapDraw = ScrapDrawObject.Copy(); scrapDraw.Angle = Global.Rand.Next(360); newObject = new ObjectSmoke(putPoint.X, putPoint.Y, ScrapWidth, ScrapHeight, fadeTime, 1, 0, scrapDraw, moveObject); newObject.Propertys.Add(new PropertyRotate(-1, Global.Rand.Next(280, 520), false, true)); } moveObject.Target.SetObject(newObject); Owner.Container.Add(newObject); idx += idxPlus; if (idx >= getPoints.Count) { idx = Global.Rand.Next(idxPlus); } } } base.DoAfterDead(killer, deadType); }