예제 #1
0
        public Chit DrawChit(Chit.ElementType e)
        {
            if (ChitsLeft() == 0)
            {
                return(null);
            }

            Chit chit = chits.Find(c => c.Element == e);

            chits.Remove(chit);
            return(chit);
        }
예제 #2
0
        public Chit DrawChit()
        {
            if (ChitsLeft() == 0)
            {
                return(null);
            }

            int  i = random.Next(chits.Count);
            Chit c = chits[i];

            chits.RemoveAt(i);
            return(c);
        }
예제 #3
0
 internal int[] FindChit(Chit c)
 {
     for (int i = 0; i < chits.GetUpperBound(0); i++)
     {
         for (int j = 0; j < chits.GetUpperBound(1); j++)
         {
             if (chits[i, j] == c)
             {
                 return(new int[] { i, j });
             }
         }
     }
     return(null);
 }
예제 #4
0
        public Tile[] TilesFor(Chit c)
        {
            // We map chits to a double-width array
            var pair = FindChit(c);
            int i    = pair[0];
            int j    = pair[1];

            j /= 2;

            // FIXME: This is completely wrong.
            return(new Tile[] {
                tiles[i, j],
                tiles[i - 1, j],
                tiles[i, j - 1]
            });
        }
예제 #5
0
        public Map()
        {
            for (int i = 0; i <= tiles.GetUpperBound(0); i++)
            {
                for (int j = 0; j <= tiles.GetUpperBound(1); j++)
                {
                    tiles[i, j] = new Tile();
                }
            }

            Tiles = new DataArrayWrapper <Tile>(tiles);

            for (int i = 0; i <= chits.GetUpperBound(0); i++)
            {
                for (int j = 0; j <= chits.GetUpperBound(1); j++)
                {
                    chits[i, j] = new Chit();
                }
            }

            Chits = new DataArrayWrapper <Chit>(chits);
        }
예제 #6
0
 public virtual Tile[] TilesFor(Chit c)
 {
     return g.map.TilesFor(c);
 }
예제 #7
0
 public void RemoveChit(Chit chit)
 {
     chit.Element = Chit.ElementType.None;
 }
예제 #8
0
 public void PlaceChit(Chit chit, Chit.ElementType elementType)
 {
     chit.Element = elementType;
 }
예제 #9
0
 public void AddElementToPlayer(Player player, Chit.ElementType element)
 {
     player.Adapt(element);
 }
예제 #10
0
파일: ActionSpace.cs 프로젝트: pvh/dominate
 public SpeciationActionSpace(Chit.ElementType element)
     : base(ActionType.Speciation)
 {
     Element = element;
 }
예제 #11
0
파일: chit.cs 프로젝트: pvh/dominate
 public void ReturnChit(Chit chit)
 {
     chits.Add(chit);
 }
예제 #12
0
 public void ReturnChit(Chit chit)
 {
     chits.Add(chit);
 }
예제 #13
0
 public virtual Tile[] TilesFor(Chit c)
 {
     return(g.map.TilesFor(c));
 }
예제 #14
0
 public void RemoveChit(Chit chit)
 {
     chit.Element = Chit.ElementType.None;
 }
예제 #15
0
 public void PlaceChit(Chit chit, Chit.ElementType elementType)
 {
     chit.Element = elementType;
 }
예제 #16
0
파일: player.cs 프로젝트: pvh/dominate
        internal int Adapt(Chit.ElementType e)
        {
            if (!CanAdapt())
            throw new System.Exception("Already fully adapted.");

              var adapted = adaptation[e] + 1;
              adaptation[e] = adapted;
              return adapted;
        }
예제 #17
0
파일: player.cs 프로젝트: pvh/dominate
        public int AdaptationTo(Chit.ElementType e)
        {
            if (e == Chit.ElementType.None || e == Chit.ElementType.Invalid)
              {
            return 0;
              }

              int adapted = adaptation[e];
              if (bonus[Animal] == e)
              {
            adapted += 2;

            if (Animal == Animal.Amphibian)
            {
              adapted++;
            }
              }
              return adapted;
        }
예제 #18
0
파일: chit.cs 프로젝트: pvh/dominate
        public Chit DrawChit(Chit.ElementType e)
        {
            if (ChitsLeft() == 0) return null;

              Chit chit = chits.Find(c => c.Element == e);
              chits.Remove(chit);
              return chit;
        }