Beispiel #1
0
        public void AddShotType(ShotType shot_type)
        {
            if (ContainsShotName(shot_type.Name))
            {
                throw new ArgumentException("Shot to be added has a duplicate name.");
            }

            ShotTypes.Add(shot_type);
        }
Beispiel #2
0
 public Shot(ShotTypes shotType)
 {
     Position = Vector2.Zero;
     Velocity = Vector2.Zero;
     Visible = false;
     TravelDistance = 0.0f;
     Mass = 0.5f;
     ShotType = shotType;
 }
Beispiel #3
0
        public void AddStillShotType(string name, string sprite_name, int collision, Color delay_color)
        {
            if (ContainsShotName(name))
            {
                throw new ArgumentException("Shot to be added has a duplicate name.");
            }

            ShotTypes.Add(new StillShotType(name, GetSpriteByName(sprite_name), collision, delay_color));
        }
Beispiel #4
0
        public void AddAnimationShotType(string name, int collision, Color delay_color)
        {
            if (ContainsShotName(name))
            {
                throw new ArgumentException("Shot to be added has a duplicate name.");
            }

            ShotTypes.Add(new AnimationShotType(name, collision, delay_color));
        }
Beispiel #5
0
 public FlagType(string name, string abbv, FlagEndurances _endurance, ShotTypes sType, FlagQualities quality, TeamColors team, string help)
 {
     FlagName      = name;
     FlagAbbv      = abbv;
     FlagEndurance = _endurance;
     FlagShot      = sType;
     FlagQuality   = quality;
     FlagTeam      = team;
     FlagHelp      = help;
     Custom        = false;
 }
Beispiel #6
0
        public override void Unpack(byte[] data)
        {
            Reset(data);

            Abreviation = ReadFixedSizeString(2);
            Quality     = (FlagQualities)ReadByte();
            ShotType    = (ShotTypes)ReadByte();

            Name     = ReadULongPascalString();
            HelpText = ReadULongPascalString();
        }
 void _useShot(ShotTypes shotType)
 {
     if (shotType == ShotTypes.BASEBALL)
     {
         usedBaseball = true;
     }
     else
     if (shotType == ShotTypes.FOOTBALL)
     {
         usedFootball = true;
     }
     else
     if (shotType == ShotTypes.FRISBEE)
     {
         usedFrisbee = true;
     }
     else
     if (shotType == ShotTypes.HOCKEYPUCK)
     {
         usedHockeyPuck = true;
     }
     else
     if (shotType == ShotTypes.NERFFOOTBALL)
     {
         usedNerfFootball = true;
     }
     else
     if (shotType == ShotTypes.SOCCERBALL)
     {
         usedSoccerBall = true;
     }
     else
     if (shotType == ShotTypes.TENNISBALL)
     {
         usedTennisBall = true;
     }
     else
     if (shotType == ShotTypes.VOLLEYBALL)
     {
         usedVolleyBall = true;
     }
     sm.UseShot();
     selectedShot = ShotTypes.UNSELECTED;
 }
Beispiel #8
0
        public ShotParams()
        {
            if (rand == null)
            {
                rand = new System.Random();
            }
            float sumW = 0;

            foreach (var item in shotTypeWeights)
            {
                type  = item.Key;
                sumW += item.Value;
            }
            int   typeIndex = (int)(rand.NextDouble() * sumW);
            float currW     = 0;

            foreach (var item in shotTypeWeights)
            {
                currW += item.Value;
                if (typeIndex < currW)
                {
                    type = item.Key;
                    break;
                }
            }

            color = possibleColors [(int)(UnityEngine.Random.value * possibleColors.Length)];
            if (type == ShotTypes.InstantBlech)
            {
                timeToLive = 1;
            }
            else
            {
                timeToLive = 2;
            }
        }
Beispiel #9
0
 private void RemoveShotTypeAt(int index)
 {
     ShotTypes.RemoveAt(index);
 }
Beispiel #10
0
 public ShotParams(ShotTypes type, GameColors color, int timeToLive)
 {
     this.type       = type;
     this.color      = color;
     this.timeToLive = timeToLive;
 }
 void SelectShotType(ShotTypes shotType)
 {
     //TODO: state machine for checking if each shot type can be selected
     if (shotType == ShotTypes.BASEBALL)
     {
         if (!usedBaseball)
         {
             selectedShot = ShotTypes.BASEBALL;
         }
     }
     else
     if (shotType == ShotTypes.FOOTBALL)
     {
         if (!usedFootball)
         {
             selectedShot = ShotTypes.FOOTBALL;
         }
     }
     else
     if (shotType == ShotTypes.FRISBEE)
     {
         if (!usedFrisbee)
         {
             selectedShot = ShotTypes.FRISBEE;
         }
     }
     else
     if (shotType == ShotTypes.HOCKEYPUCK)
     {
         if (!usedHockeyPuck)
         {
             selectedShot = ShotTypes.HOCKEYPUCK;
         }
     }
     else
     if (shotType == ShotTypes.NERFFOOTBALL)
     {
         if (!usedNerfFootball)
         {
             selectedShot = ShotTypes.NERFFOOTBALL;
         }
     }
     else
     if (shotType == ShotTypes.SOCCERBALL)
     {
         if (!usedSoccerBall)
         {
             selectedShot = ShotTypes.SOCCERBALL;
         }
     }
     else
     if (shotType == ShotTypes.TENNISBALL)
     {
         if (!usedTennisBall)
         {
             selectedShot = ShotTypes.TENNISBALL;
         }
     }
     else
     if (shotType == ShotTypes.VOLLEYBALL)
     {
         if (!usedVolleyBall)
         {
             selectedShot = ShotTypes.VOLLEYBALL;
         }
     }
     sm.ChangeSelection(selectedShot);
 }
Beispiel #12
0
 public ShotParams(ShotTypes type, GameColors color, int timeToLive)
 {
     this.type = type;
     this.color = color;
     this.timeToLive = timeToLive;
 }
Beispiel #13
0
        public ShotParams()
        {
            if (rand == null)
            {
                rand = new System.Random();
            }
            float sumW = 0;
            foreach (var item in shotTypeWeights)
            {
                type = item.Key;
                sumW += item.Value;
            }
            int typeIndex = (int)(rand.NextDouble() * sumW);
            float currW = 0;
            foreach (var item in shotTypeWeights)
            {
                currW += item.Value;
                if (typeIndex < currW)
                {
                    type = item.Key;
                    break;
                }
            }

            color = possibleColors [(int)(UnityEngine.Random.value * possibleColors.Length)];
            if (type == ShotTypes.InstantBlech)
            {
                timeToLive = 1;
            }
            else
            {
                timeToLive = 2;
            }
        }