//當item被吃到時,呼叫此function,對傳入的player做出效果 public void Item_get(Player _player) { switch (type) { case TypeItem.Amount: break; case TypeItem.Power: break; case TypeItem.Speed: break; } }
void CreatePlayer() { for (int i = 0; i < _PlayerAmount; i++) { Player newPlayer = new Player(_window , i); newPlayer.Start(); Game_data.instance.Player_list.Add(newPlayer); //請在這裡將Player秀到_window上 } }
public void Player_item(Player player) { //玩家跟道具 for (int row = 0; row < _height; row++) { for (int col = 0; col < _width; col++) { if (Game_data.instance._map[row, col] == 3) { if (tools.AABBtest(player._PositionX, player._PositionY, player._PositionX + 55, player._PositionY + 55, col * 60 + 10, row * 60 + 10, col * 60 + 50, row * 60 + 50)) { Game_data.instance._map[row, col] = 0; if (player._Speed * 1.1f <= player.MaxSpeed) { player._Speed = player._Speed * 1.1f; } } } else if (Game_data.instance._map[row, col] == 4) { if (tools.AABBtest(player._PositionX, player._PositionY, player._PositionX + 55, player._PositionY + 55, col * 60 + 10, row * 60 + 10, col * 60 + 50, row * 60 + 50)) { Game_data.instance._map[row, col] = 0; if (player._Power + 1 <= player.MaxPower) { player._Power++; } } } else if (Game_data.instance._map[row, col] == 5) { if (tools.AABBtest(player._PositionX, player._PositionY, player._PositionX + 55, player._PositionY + 55, col * 60 + 10, row * 60 + 10, col * 60 + 50, row * 60 + 50)) { Game_data.instance._map[row, col] = 0; if (player._BNumber + 1 <= player.MaxBNumber) { //player._BNumber++; player._Can_BNumber++; } } } } } }