Example #1
0
 public virtual void SpawnCommander(ManagerHelper mH, Type commanderType, NPC.AffliationTypes team, Vector2 point)
 {
     if (commanderType == typeof(RedCommander))
     {
         mH.GetNPCManager().Add(new RedCommander(point, team));
     }
     else if (commanderType == typeof(BlueCommander))
     {
         mH.GetNPCManager().Add(new BlueCommander(point, team));
     }
     else if (commanderType == typeof(GreenCommander))
     {
         mH.GetNPCManager().Add(new GreenCommander(point, team));
     }
     else if (commanderType == typeof(YellowCommander))
     {
         mH.GetNPCManager().Add(new YellowCommander(point, team));
     }
     else if (commanderType == typeof(RedPlayerCommander))
     {
         mH.GetNPCManager().Add(new RedPlayerCommander(point, team, mH));
     }
     else if (commanderType == typeof(BluePlayerCommander))
     {
         mH.GetNPCManager().Add(new BluePlayerCommander(point, team, mH));
     }
     else if (commanderType == typeof(GreenPlayerCommander))
     {
         mH.GetNPCManager().Add(new GreenPlayerCommander(point, team, mH));
     }
     else if (commanderType == typeof(YellowPlayerCommander))
     {
         mH.GetNPCManager().Add(new YellowPlayerCommander(point, team, mH));
     }
 }
Example #2
0
 public void UpdateQuickestSuccessfulCapture(NPC.AffliationTypes a)
 {
     if (timeFlagAway[a] < quickestFlagCapture[a])
     {
         quickestFlagCapture[a] = timeFlagAway[a];
     }
 }
Example #3
0
        public virtual void Set(String a, Vector2 p, NPC n, Vector2 v, int d, bool iE, bool collide, float dT, ManagerHelper mH)
        {
            asset         = a;
            position      = p;
            velocity      = v;
            damage        = d;                  // set damage
            existenceTime = 4;                  // Default 10 seconds
            drawTime      = dT;                 //set up draw time
            affiliation   = n.GetAffiliation(); //Sets up hurting
            creator       = n;

            isExplosive   = iE;
            shouldCollide = collide;

            //Get x and y values from angle and set up direction
            rotation = DWMath.Atan2(velocity.Y, velocity.X);

            //No friction
            drag = 0;

            LoadContent(mH.GetTextureManager());
            if (!(this is Tossable))
            {
                setModeIndex();//set mode index
            }
        }
Example #4
0
 public void UpdateMostTimeFlagAway(NPC.AffliationTypes a)
 {
     if (timeFlagAway[a] > mostTimeFlagAway[a])
     {
         mostTimeFlagAway[a] = timeFlagAway[a];
     }
 }
Example #5
0
        public void Intitialize(ManagerHelper mH)
        {
            //kd stuff
            medicKills     = 0;
            flagsCaptured  = new Dictionary <NPC.AffliationTypes, int>();
            flagsReturned  = new Dictionary <NPC.AffliationTypes, int>();
            rocksDestroyed = new Dictionary <NPC.AffliationTypes, int>();
            dotsRecruited  = new Dictionary <NPC.AffliationTypes, int>();

            killsToCommanders         = new int[4, 4];
            vendittaKills             = 0;
            vendittaKiller            = NPC.AffliationTypes.black;
            vendittaVictim            = NPC.AffliationTypes.black;
            rocksCreatedCounter       = 0;
            waterSpilledCounter       = 0;
            lightningTravelledCounter = 0;
            foreach (NPC.AffliationTypes a in affilations)
            {
                flagsCaptured.Add(a, 0);
                flagsReturned.Add(a, 0);
                rocksDestroyed.Add(a, 0);
                dotsRecruited.Add(a, 0);

                stats.Add(a, mH.GetNPCManager().GetStats(a));
            }
        }
Example #6
0
            public Camera(Type cT, Rectangle d, int i, NPC.AffliationTypes color)
            {
                commanderType = cT;
                teammateColor = color;
                focus         = new Vector2(d.Width / 2, d.Height / 2);
                dimensions    = d;
                port          = new Viewport(d);
                zoom          = 1;
                index         = i;

                switch (i)
                {
                case 0:
                    gamePadIndex = PlayerIndex.One;
                    break;

                case 1:
                    gamePadIndex = PlayerIndex.Two;
                    break;

                case 2:
                    gamePadIndex = PlayerIndex.Three;
                    break;

                case 3:
                    gamePadIndex = PlayerIndex.Four;
                    break;
                }

                oldState = GamePad.GetState(PlayerIndex.One);
            }
Example #7
0
        public CTFBase(NPC.AffliationTypes aT, Vector2 p, ManagerHelper mH)
            : base("bases", p, Vector2.Zero)
        {
            affiliation = aT;

            spawnCounter = 0;
            spawnTime    = 1.5f; //1.5 seconds

            switch (aT)
            {
            case NPC.AffliationTypes.red:
                myFlag = new RedFlag(GetOriginPosition());
                break;

            case NPC.AffliationTypes.blue:
                myFlag = new BlueFlag(GetOriginPosition());
                break;

            case NPC.AffliationTypes.green:
                myFlag = new GreenFlag(GetOriginPosition());
                break;

            case NPC.AffliationTypes.yellow:
                myFlag = new YellowFlag(GetOriginPosition());
                break;
            }
        }
Example #8
0
        public String GetQuickestFlagCaptureStatistic()
        {
            double minTime = 1000;

            NPC.AffliationTypes af = NPC.AffliationTypes.black;

            foreach (NPC.AffliationTypes a in teams)
            {
                if (quickestFlagCapture[a] < minTime)
                {
                    minTime = quickestFlagCapture[a];
                    af      = a;
                }
            }

            switch (af)
            {
            case NPC.AffliationTypes.red:
                return("Quickest flag capture was\n red flag in " + minTime + " seconds");

            case NPC.AffliationTypes.blue:
                return("Quickest flag capture was\n blue flag in " + minTime + " seconds");

            case NPC.AffliationTypes.green:
                return("Quickest flag capture was\n green flag in " + minTime + " seconds");

            case NPC.AffliationTypes.yellow:
                return("Quickest flag capture was\n yellow flag in " + minTime + " seconds");

            case NPC.AffliationTypes.black:
                return("No flag was captured.");
            }

            return("heh");
        }
Example #9
0
        public String GetMostTimeFlagAwayStatistic()
        {
            double maxTime = 0;

            NPC.AffliationTypes af = NPC.AffliationTypes.black;

            foreach (NPC.AffliationTypes a in teams)
            {
                if (mostTimeFlagAway[a] > maxTime)
                {
                    maxTime = mostTimeFlagAway[a];
                    af      = a;
                }
            }

            switch (af)
            {
            case NPC.AffliationTypes.red:
                return("Red flag " + maxTime + " seconds");

            case NPC.AffliationTypes.blue:
                return("Blue flag " + maxTime + " seconds");

            case NPC.AffliationTypes.green:
                return("Green flag " + maxTime + " seconds");

            case NPC.AffliationTypes.yellow:
                return("Yellow flag " + maxTime + " seconds");

            case NPC.AffliationTypes.black:
                return("No flag was abducted in this game");
            }

            return("heh");
        }
Example #10
0
 private void UpdateCasualities(NPC.AffliationTypes killedAffilation)
 {
     if (killedAffilation != NPC.AffliationTypes.black)
     {
         stats[killedAffilation].Casualties++;
     }
 }
Example #11
0
 public ConquestBase(Vector2 p)
     : base("bases", p, Vector2.Zero)
 {
     affiliation      = NPC.AffliationTypes.grey;
     conquestCounters = new Dictionary <NPC.AffliationTypes, Double>();
     spawns           = new List <SpawnPoint>();
     conquestTime     = 3; //three seconds
 }
Example #12
0
 public Assault(List <NPC.AffliationTypes> tL, Dictionary <Type, NPC.AffliationTypes> pL, int pC,
                NPC.AffliationTypes att, NPC.AffliationTypes def, float sT)
     : base(tL, pL, 3, pC, sT)
 {
     this.typeOfGame = GT.ASSAULT;
     //set up defender and attacker
     attacker = att;
     defender = def;
 }
Example #13
0
 public void AddExplosion(Vector2 p, NPC.AffliationTypes aT, int d)
 {
     if (inactiveExplosions.Count > 0)
     {
         Explosion temp = inactiveExplosions.Pop();
         temp.Set(p, d, aT, managers);
         activeExplosions.Enqueue(temp);
     }
 }
Example #14
0
 public void AddFireball(Vector2 p, Vector2 direction, NPC.AffliationTypes aT)
 {
     if (inactiveFireballs.Count > 0)
     {
         Fireball temp = inactiveFireballs.Pop();
         temp.Set(p, direction, aT, managers);
         activeFireballs.Enqueue(temp);
     }
 }
Example #15
0
 public void AddLightning(Vector2 p, float r, NPC.AffliationTypes aT)
 {
     if (inactiveLightning.Count > 0)
     {
         LightningTrail temp = inactiveLightning.Pop();
         temp.Set(p, r, aT, managers);
         activeLightning.Enqueue(temp);
     }
 }
Example #16
0
 public void AddWaterpool(Vector2 p, NPC.AffliationTypes aT)
 {
     if (inactiveWaterpools.Count > 0)
     {
         WaterPool temp = inactiveWaterpools.Pop();
         temp.Set(p, aT, managers);
         activeWaterpools.Enqueue(temp);
     }
 }
Example #17
0
        public void Set(Vector2 p, float r, NPC.AffliationTypes aT, ManagerHelper mH)
        {
            affiliation = aT;
            rotation    = r;
            position    = p;

            lifeTimer = 2;

            mH.GetAudioManager().Play(AudioManager.SPARK, (float)mH.GetRandom().NextDouble() / 4 + 0.5f, AudioManager.RandomPitch(mH), 0, false);
        }
Example #18
0
        public Flag(string a, Vector2 p, NPC.AffliationTypes aT)
            : base(a, p)
        {
            affiliation  = aT;
            status       = FlagStatus.home;
            homePosition = p;

            //Animations
            timer   = 0;
            endTime = 0.1f;
        }
Example #19
0
        public NPC.AffliationTypes GetSecondaryWinner(NPC.AffliationTypes winner)
        {
            foreach (KeyValuePair <Type, NPC.AffliationTypes> commander in commanders)
            {
                if (NPC.CommanderColor(commander.Key) != winner && commander.Value == winner)
                {
                    return(NPC.CommanderColor(commander.Key));
                }
            }

            return(NPC.AffliationTypes.red);
        }
Example #20
0
        public void Set(Vector2 p, NPC.AffliationTypes aT, ManagerHelper mH)
        {
            originPosition = p;
            position       = p - origin;
            affiliation    = aT;
            animateTimer   = 0;
            rotation       = (float)(Math.PI * 2 * mH.GetRandom().NextDouble());
            splash.SetOriginPosition(originPosition);
            splash.position = position;

            mH.GetAudioManager().Play(AudioManager.WATER, (float)mH.GetRandom().NextDouble() / 4 + 0.5f, AudioManager.RandomPitch(mH), 0, false);
        }
Example #21
0
        public NPC GetCommander(NPC.AffliationTypes a)
        {
            foreach (Commander n in commanders)
            {
                if (n.GetAffiliation() == a)
                {
                    return(n);
                }
            }

            return(null);
        }
Example #22
0
        public void UpdateDeaths(NPC.AffliationTypes a)
        {
            if (stats[a].TimeAlive.Get() > stats[a].MaxTimeAlive)
            {
                stats[a].MaxTimeAlive = stats[a].TimeAlive.Get();
            }

            stats[a].TimeAlive.Set(0);
            stats[a].IsAlive = false;

            stats[a].Deaths++;
        }
Example #23
0
        public NPC GetSpecificCommander(NPC.AffliationTypes personalAffilation)
        {
            foreach (Commander n in commanders)
            {
                if (n.GetPersonalAffilation() == personalAffilation)
                {
                    return(n);
                }
            }

            return(null);
        }
Example #24
0
        public NPC GetSecondaryCommander(NPC.AffliationTypes teamAffilation)
        {
            foreach (NPC commander in commanders)
            {
                if (commander.GetAffiliation() == teamAffilation && commander.GetPersonalAffilation() != teamAffilation)
                {
                    return(commander);
                }
            }

            return(null);
        }
Example #25
0
        public void Set(Vector2 p, int d, NPC.AffliationTypes aT, ManagerHelper mH)
        {
            base.Set(asset, p, Vector2.Zero, 0.1f, 0, 0, 0.5f, mH);

            existanceTime = 0.1f;
            affiliation   = aT;
            creator       = null;
            damage        = d;
            exploaded     = false;

            mH.GetAudioManager().Play(AudioManager.EXPLOSION, AudioManager.RandomVolume(mH), AudioManager.RandomPitch(mH), 0, false);
        }
Example #26
0
 public SpawnPoint(Vector2 sP, NPC.AffliationTypes a, ManagerHelper mH)
     : base(null, sP)
 {
     spawnPoint       = sP;
     affilation       = a;
     isGoodSpawnPoint = true;
     spawnCounter     = 0;
     spawnTime        = mH.GetGametype().GetSpawnTime() * 1.1; //so same spot wont be used twice in a row
     velocity         = Vector2.Zero;
     isOneUse         = (mH.GetGametype() is Conquest) && (affilation == NPC.AffliationTypes.grey);
     isUsed           = false;
 }
Example #27
0
        public void ChangeHealth(int hM, NPC.AffliationTypes lD)
        {
            if (!IsProtected())
            {
                health += hM;

                if (health > maxHealth)
                {
                    health = maxHealth;
                }
            }
        }
Example #28
0
        public AssaultBase GetAllyBase(NPC.AffliationTypes a)
        {
            foreach (AssaultBase fB in bases)
            {
                if (fB.affiliation == a)
                {
                    return(fB);
                }
            }

            //did not find desired base
            return(null);
        }
Example #29
0
        public CTFBase GetEnemyBase(NPC.AffliationTypes a)
        {
            foreach (CTFBase fB in bases)
            {
                if (fB.affiliation != a)
                {
                    return(fB);
                }
            }

            //did not find desired base
            return(null);
        }
Example #30
0
        public List <NPC> GetAllies(NPC.AffliationTypes af)
        {
            List <NPC> tempList;

            if (agents.TryGetValue(af, out tempList))
            {
                return(tempList);
            }
            else
            {
                throw new Exception("Cannot find allies");
            }
        }