Ejemplo n.º 1
0
 public void randomPosition()
 {
     Extentions.CLocal actorMummy      = new Extentions.CLocal();
     Extentions.CLocal actorMummyIntel = new Extentions.CLocal();
     actorMummyIntel.i = 0;
     actorMummyIntel.j = 0;
     if (localActor == null)
     {
         localActor = new List <Extentions.CLocal>();
     }
     else
     {
         localActor.Clear();
     }
     actorMummy.i = random.Next() % (mapSize * 2 - 1) + 1;
     actorMummy.j = random.Next() % (mapSize * 2 - 1) + 1;
     localActor.Add(actorMummy);
     //localActor.Insert(1, actorMummy);
     while (actorMummy.i == actorMummyIntel.i && actorMummy.j == actorMummy.j ||
            actorMummyIntel.j == 0 || actorMummyIntel.i == 0)
     {
         actorMummyIntel.j = random.Next() % (mapSize * 2 - 1) + 1;
         actorMummyIntel.i = random.Next() % (mapSize * 2 - 1) + 1;
     }
     //localActor.Insert(2, actorMummyIntel);
     localActor.Add(actorMummyIntel);
 }
Ejemplo n.º 2
0
        public static CLocal Address(Vector2 position)
        {
            CLocal address = new CLocal();

            address.i = (int)(1 + Math.Abs(((position.X - (float)213) / (180 / GameMapManager.Instance.mapSize)) %
                                           (2 * GameMapManager.Instance.mapSize + 1)));
            address.j = (int)(1 + Math.Abs(((position.Y - (float)79) / (180 / GameMapManager.Instance.mapSize)) %
                                           (2 * GameMapManager.Instance.mapSize + 1)));
            return(address);
        }
Ejemplo n.º 3
0
        public static bool MummyEatExplorer()
        {
            CLocal addressMummy            = GameMapManager.Instance.localActor[1];
            CLocal addressMummyIntelligent = GameMapManager.Instance.localActor[2];
            CLocal addressExplorer         = GameMapManager.Instance.localActor[0];

            if ((addressMummy.i == addressExplorer.i && addressMummy.j == addressExplorer.j) ||
                (addressMummyIntelligent.i == addressExplorer.i &&
                 addressMummyIntelligent.j == addressExplorer.j))
            {
                GameMapManager.Instance.isGameOver = true;
                GameMapManager.Instance.isOptions  = true;
                return(true);
            }
            return(false);
        }
Ejemplo n.º 4
0
 public static void UpdatePosition(CLocal address, int index)
 {
     GameMapManager.Instance.localActor[index].i = address.i;
     GameMapManager.Instance.localActor[index].j = address.j;
 }