Exemple #1
0
 public void checkTarget(BattlePuppet enemy)
 {
     if (distance(enemy.HitBox.Center) <= sightRange)
     {
         BattleTargets.Add(enemy);
     }
 }
Exemple #2
0
        private void generatePlayerPuppets(Army army, Point startPosition)
        {
            foreach (Squad squad in army.squads)
            {
                if (squad != null)
                {
                    BattlePuppetSquad puppetSquad = new BattlePuppetSquad();

                    Rectangle squadRect = new Rectangle(startPosition.X + squad.Row * BattleArea.Height / 8, startPosition.Y + squad.Column * BattleArea.Height / 8, BattleArea.Height / 8, BattleArea.Height / 8);
                    for (int i = 0; i < squad.MaxSize; i++)
                    {
                        if (squad.units[i] != null)
                        {
                            BattlePuppet temp = new BattlePuppet(this, squad.units[i], squadRect.X + squadRect.Width - (i * (squadRect.Width / squad.MaxSize)), squadRect.Y + (squadRect.Height / 2), BattleArea.Center);
                            temp.Destination = new Point(BattleArea.Right, temp.HitBox.Y);
                            PlayerPuppets.Add(temp);
                            puppetSquad.puppets.Add(temp);
                            ////leader
                            //if (i == 0)
                            //{
                            //    PlayerPuppets.Add(new BattlePuppet(squad.units[i], squadRect.X + squadRect.Width - (squadRect.Width / 4), squadRect.Y + (squadRect.Height / 3), BattleArea.Center));
                            //}
                            ////others
                            //else
                            //{
                            //    PlayerPuppets.Add(new BattlePuppet(squad.units[i], squadRect.X + squadRect.Width - (squadRect.Width / 4), squadRect.Y + (squadRect.Height / 3), BattleArea.Center));
                            //}
                        }
                    }
                    PlayerSquads.Add(puppetSquad);
                    //        foreach (Unit unit in squad.units)
                    //        {
                    //            if (unit != null)
                    //            {
                    //                //get init position from squad
                    //                BattlePuppet puppet = new BattlePuppet(unit, 0, 0, 2);
                    //                puppets.Add(puppet);
                    //            }
                    //        }
                }
            }
        }