Example #1
0
 public bool AssignToGrid(Shape s)
 {
     if (this[s.position] == null)
     {
         this[s.position] = s;
         return true;
     }
     else return false;
 }
Example #2
0
 public virtual bool CollisionCheck(Shape other)
 {
     return Vector2.Distance(other.position, position) <= RADIUS * 2;
 }
Example #3
0
 protected Sprite GenerateSprite(Shape s)
 {
     return new Sprite(textures[s.GetType()],
         FieldToScreen(s.position),
         PolarityColor(s.polarity),
         -s.Direction,
         new Vector2(RAD, RAD), (float)Shape.RADIUS / RAD, 0F);
 }
Example #4
0
 private void Spawn(Shape s)
 {
     if (!AssignToGrid(s)) return; //square was occupied
     if (s is Player)
     {
         if (player == null)
             player = (Player)s;
         //we can't add a second player
         else this[s.position] = null;
     }
     else enemies.Add(s);
 }