Beispiel #1
0
        VBUnitAI GetNextPlayerActive(VBUnitAI LastPlayer)
        {
            VBUnitAI newUnit = LastPlayer;

            activeEnt = null;

            //Get the next player
            if (combatants.Find(newUnit) == combatants.Last)
            {
                newUnit = combatants.First.Value;
            }
            else
            {
                newUnit = combatants.Find(newUnit).Next.Value;
            }

            if (newUnit == null || newUnit.IsSetForDeletion)
            {
                return(GetNextPlayerActive(newUnit));
            }
            else
            {
                return(newUnit);
            }
        }
Beispiel #2
0
 public void TurnEnded()
 {
     //set next player
     activeEnt = GetNextPlayerActive(activeEnt);
     //FIXME: set cam here
     activeEnt.InitiatetTurn();
     turnNumber += 1;
 }
Beispiel #3
0
        public static void StartCombat(VBUnitAI starter)
        {
            if (CombatManager.Instance != null)
            {
                return;
            }

            CombatManager i = (CombatManager)Entities.Instance.Create("CombatManager", Map.Instance);

            i.PostCreate();
            i.CreateCombatantList(starter);
        }
Beispiel #4
0
        public bool InCombat(VBUnitAI u)
        {
            foreach (VBUnitAI unit in combatants)
            {
                if (unit != null && !unit.IsSetForDeletion)
                {
                    if (u == unit)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #5
0
        public void CreateCombatantList(VBUnitAI ch)
        {
            Map.Instance.GetObjects(new Sphere(ch.ControlledObject.Position, ch.ControlledObject.ViewRadius + 30), MapObjectSceneGraphGroups.UnitGroupMask, delegate(MapObject mapObject)
            {
                VBCharacter c = mapObject as VBCharacter;
                if (c != null)
                {
                    combatants.AddLast(c.Intellect);
                }
            });

            //reset all tasks
            foreach (VBUnitAI combatant in combatants)
            {
                combatant.ResetForCombat();
            }

            starter = activeEnt = ch;
            ch.InitiatetTurn();

            //TODO: ARRANGE LIST BY SEQUENCE
        }
Beispiel #6
0
        bool FoesAlive()
        {
            VBUnitAI toCheck = null;

            foreach (VBUnitAI u in combatants)
            {
                if (u != null && !u.IsSetForDeletion)
                {
                    if (toCheck != null)
                    {
                        if (u.IsEnemy(toCheck))
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        toCheck = u;
                    }
                }
            }

            return(false);
        }
Beispiel #7
0
 public void JoinCombat(VBUnitAI u)
 {
     combatants.AddLast(u);
 }