Пример #1
0
    public void changePlace(int sx, int sy, int tx, int ty)
    {
        Minons temp = gameBoard[sx, sy];

        gameBoard[sx, sy] = null;
        gameBoard[tx, ty] = temp;
    }
Пример #2
0
    private void FixedUpdate()
    {
        if (gamestate == game_state.battle)
        {
            bool AllOneSide = true;
            int  playerID   = -1;
            int  count      = 0;
            foreach (Minons m in battleList)
            {
                count++;
                if (playerID == -1)
                {
                    playerID = m.player;
                }
                else if (playerID != m.player)
                {
                    AllOneSide = false;
                    break;
                }
            }
            if (AllOneSide)
            {
                RoundEnd(playerID, count);
            }
            foreach (Minons m in battleList)
            {
                m.CallBack(0);
                //m.state = 0;
            }

            foreach (Minons m in battleList)
            {
                m.CallBack(1);
            }

            foreach (Minons m in battleList)
            {
                Minons temp = m.deathBehavior();
                // m.state = 2;
                if (temp != null)
                {
                    deadList.Add(temp);
                }
            }
            battleList = battleList.Except(deadList).ToList();
        }
    }
Пример #3
0
 private void moveBehavior()
 {
     if (locked == null)
     {
         locked = findTarget();
         if (locked == null)
         {
             print("game end");
             return;
         }
     }
     Ifinrange();
     if (inrange == false)
     {
         blinkMove();
     }
 }
Пример #4
0
    private Minons findTarget()
    {
        Dictionary <Minons, int> distanceList = new Dictionary <Minons, int>();
        int i = 0;
        int j = 0;

        for (i = 0; i < 5; i++)
        {
            for (j = 0; j < 5; j++)
            {
                if (gb.gameBoard[i, j] != null)
                {
                    if (distanceList.ContainsKey(gb.gameBoard[i, j]))
                    {
                        distanceList[gb.gameBoard[i, j]] = getDis(i, j);
                    }
                    else
                    {
                        distanceList.Add(gb.gameBoard[i, j], getDis(i, j));
                    }
                }
            }
        }
        int    maxDis   = 0;
        Minons maxMinon = null;

        foreach (KeyValuePair <Minons, int> entry in distanceList)
        {
            if (entry.Key.player == this.player)
            {
                continue;
            }
            if (maxDis < entry.Value)
            {
                maxDis   = entry.Value;
                maxMinon = entry.Key;
            }
        }
        maxdistance = maxDis;
        return(maxMinon);
    }
Пример #5
0
 private void makeTarget()
 {
     locked = findTarget();
 }
Пример #6
0
 public void deleBattleList(Minons theMinion)
 {
     battleList.Remove(theMinion);
     gameBoard[theMinion.px, theMinion.py] = null;
 }
Пример #7
0
 public void addBattleList(Minons theMinion)
 {
     battleList.Add(theMinion);
     gameBoard[theMinion.px, theMinion.py] = theMinion;
 }