Exemplo n.º 1
0
        public override void SetDetailsFromSetup(Detail detail, CoreDetails core)
        {
            // Routes
            RouteManager  router    = new RouteManager();
            List <string> eneRoutes = router.GetRouteNames(core.routeName);

            eneRoutes.AddRange(EnemyInfo.GetCP(core.CPName).CPsoldierRoutes);
            routes = eneRoutes;

            // Bodies
            List <string> eneBodies = NPCBodyInfo.GetRegionBodies(core.locationID).ToList();

            bodies = eneBodies;

            // SubTypes
            List <string> eneSubTypes = NPCBodyInfo.GetRegionSubTypes(core.locationID).ToList();

            subtypes = eneSubTypes;

            // Add/remove/modify detail soldiers
            string[] soldiers = new string[0];
            if (core.CPName != "NONE" || core.routeName != "NONE")
            {
                soldiers = EnemyInfo.GetQuestSoldierNames(core.CPName, core.locationID);
            }

            List <Enemy> qObjects     = detail.GetQuestObjects().Cast <Enemy>().ToList();
            int          soldierCount = soldiers.Length;
            int          objectCount  = qObjects.Count;

            for (int i = 0; i < soldierCount; i++)
            {
                if (i >= objectCount) // add
                {
                    qObjects.Add(new Enemy(soldiers[i]));
                }
                else // modify
                {
                    qObjects[i].name = soldiers[i];
                }
            }

            for (int i = objectCount - 1; i >= soldierCount; i--) //remove
            {
                qObjects.RemoveAt(i);
            }

            detail.SetQuestObjects(qObjects.Cast <QuestObject>().ToList());
            EnemyBox.ResetFovaCounts();
        }