public void Del(EnemyCard card) { cards.Remove(card); outCards.Add(card); card.damageTimer = 0; card.step = EnemyCard.Step.Lost; //layer.Del(card); }
public void Add(Data.Character character) { var num = cards.Count; var wMargin = 200; var y = 600; var x = 50; var bmp = new System.Drawing.Bitmap(character.imagePath); var sprite = new EnemyCard(bmp, new Vector2D(x + wMargin * num, y), character.Name, character); layer.Add(sprite, 10); cards.Add(sprite); character.enemyCard = sprite; SetupCardPos(); }
public void Update() { { var tmp = new List <EnemyCard>(); foreach (var card in outCards) { card.Update(); if (card.IsLost()) { layer.Del(card); } else { tmp.Add(card); } } outCards = tmp; } switch (uITargetSelectType) { case UITargetSelectType.None: { var mousePosition = Emugen.Input.InputCore.Instance.mousePosition; var tmp = default(EnemyCard); var tmpRange = -1.0; foreach (var card in cards) { card.isMouseOnUITarget = false; card.mouseOnTarget.IsDraw = false; if (card.isMouseOn) { var cr = card.Rect; var range = Math.Sqrt(Math.Pow(mousePosition.X - (cr.Position.X + cr.Size.X / 2), 2) + Math.Pow(mousePosition.Y - (cr.Position.Y + cr.Size.Y / 2), 2)); if ((tmp == null) || (range < tmpRange)) { tmp = card; tmpRange = range; } } } if (tmp != null) { tmp.isMouseOnUITarget = true; tmp.mouseOnTarget.IsDraw = true; } } break; case UITargetSelectType.One: { var mousePosition = Emugen.Input.InputCore.Instance.mousePosition; var tmp = default(EnemyCard); var tmpRange = -1.0; foreach (var card in cards) { card.isMouseOnUITarget = false; card.mouseOnTarget.IsDraw = false; if (card.isMouseOn) { var cr = card.Rect; var range = Math.Sqrt(Math.Pow(mousePosition.X - (cr.Position.X + cr.Size.X / 2), 2) + Math.Pow(mousePosition.Y - (cr.Position.Y + cr.Size.Y / 2), 2)); if ((tmp == null) || (range < tmpRange)) { tmp = card; tmpRange = range; } } } if (tmp != null) { tmp.isMouseOnUITarget = true; tmp.mouseOnTarget.IsDraw = true; } } break; case UITargetSelectType.LineHorizontal: { var mousePosition = Emugen.Input.InputCore.Instance.mousePosition; var tmp = default(EnemyCard); var tmpRange = -1.0; foreach (var card in cards) { card.isMouseOnUITarget = false; card.mouseOnTarget.IsDraw = false; if (card.isMouseOn) { var cr = card.Rect; var range = Math.Sqrt(Math.Pow(mousePosition.X - (cr.Position.X + cr.Size.X / 2), 2) + Math.Pow(mousePosition.Y - (cr.Position.Y + cr.Size.Y / 2), 2)); if ((tmp == null) || (range < tmpRange)) { tmp = card; tmpRange = range; } } } if (tmp != null) { tmp.isMouseOnUITarget = true; tmp.mouseOnTarget.IsDraw = true; var linePosition = tmp.character.linePosition; foreach (var card in cards) { if (card.character.linePosition == linePosition) { card.isMouseOnUITarget = true; card.mouseOnTarget.IsDraw = true; } } } if ((lastMouseOnTargetCard != tmp) && (tmp != null)) { var linePosition = tmp.character.linePosition; foreach (var card in cards) { if (card.character.linePosition == linePosition) { card.mouseOnTargetFadeTimer = 0; } } } lastMouseOnTargetCard = tmp; } break; } var selectCard = default(UI.EnemyCard.EnemyCard); foreach (var card in cards) { card.Update(); if (card.isMouseOnUITarget) { selectCard = card; } } { var input = Emugen.Input.InputCore.Instance; if (input.GetKeyEventType(Emugen.Input.InputCore.KeyEventCode.MouseLeftButton) == Emugen.Input.InputCore.KeyEventType.Up) { if (selectCard != null) { var selectCards = new List <EnemyCard>(); foreach (var card in cards) { if (card.isMouseOnUITarget) { selectCards.Add(card); } } if (OnSelected != null) { OnSelected(selectCards); } } } } }