//Mixes up the custom character list public void Scrandle() { Random rand = new Random(); int n = customCharacterList.Count; while (n > 1) { n--; int k = rand.Next(n + 1); CustomCharacter swap = customCharacterList[k]; customCharacterList[k] = customCharacterList[n]; customCharacterList[n] = swap; } }
public void Start() { lx = mainMan.GameMan.LeftPathBound.X; ly = mainMan.GameMan.LeftPathBound.Y; lw = mainMan.GameMan.LeftPathBound.Width; lh = mainMan.GameMan.LeftPathBound.Height; rx = mainMan.GameMan.RightPathBound.X; ry = mainMan.GameMan.RightPathBound.Y; rw = mainMan.GameMan.RightPathBound.Width; rh = mainMan.GameMan.RightPathBound.Height; tx = mainMan.GameMan.TopPathBound.X; ty = mainMan.GameMan.TopPathBound.Y; tw = mainMan.GameMan.TopPathBound.Width; th = mainMan.GameMan.TopPathBound.Height; bx = mainMan.GameMan.LowerPathBound.X; by = mainMan.GameMan.LowerPathBound.Y; bw = mainMan.GameMan.LowerPathBound.Width; bh = mainMan.GameMan.LowerPathBound.Height; tribalNum = 30; goodNum = 30; thiefNum = 30; richNum = 30; respawnTime = 5; //Loading in the Custom Characters String[] fileNames = Directory.GetFiles("../../../Content/CustomEnemies"); StreamReader input; for (int i = 0; i < fileNames.Length; i++) { input = new StreamReader(fileNames[i]); string customCharacterString = input.ReadLine(); CustomCharacter dummy = JsonConvert.DeserializeObject <CustomCharacter>(customCharacterString); customCharacterList.Add(dummy); } }
public override void Init() { Type = Faction.Tribal; NormalColor = Color.White; //NormalColor = Color.Purple; CustomCharacter custom = mainMan.GameMan.SpawnMan.GetCustomCharacter(Faction.Tribal); this.name = custom.Name; //Set AI state prob AIProbs.Add(AIState.Attack, (float)custom.Aggression); AIProbs.Add(AIState.Flank, 0.1f); AIProbs.Add(AIState.Ability, (float)custom.Ability); AIProbs.Add(AIState.Defend, (float)custom.Defense); AIProbs.Add(AIState.Cower, (float)custom.Cowardice); AIProbs.Add(AIState.Ready, 0.3f); AIProbs.Add(AIState.Idle, 0.4f); //Set AI timers AITimers.Add(AIState.Attack, 2f); AITimers.Add(AIState.Swing, 0.25f); AITimers.Add(AIState.Defend, 4f); AITimers.Add(AIState.Ability, 3f); AITimers.Add(AIState.Idle, 0.2f); //Encounter AI State list EncounterAIStates.Add(AIState.Attack); EncounterAIStates.Add(AIState.Ability); EncounterAIStates.Add(AIState.Defend); SightRange = 250f; AttackRange = 50f; base.Init(); InitStats(); }