Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package project;
- import java.util.ArrayList;
- import javafx.util.Pair;
- /**
- *
- * @author MoHaMaD
- */
- public class Square {
- //private int i = 0;
- int x, y;
- private ArrayList<Pair<Champion, Player>> ChampionsInSquare = new ArrayList<>();
- public Square(int x, int y) {
- this.x = x;
- this.y = y;
- }
- ArrayList<Pair<Champion, Player>> GetChampionInSquare() {
- return ChampionsInSquare;
- }
- int GetNumberChampionInSquare() {
- return ChampionsInSquare.size();
- }
- boolean IsEmpty() {
- return (ChampionsInSquare.isEmpty());
- }
- void SetXandY(int x, int y) {
- this.x = x;
- this.y = y;
- }
- int GetX() {
- return x;
- }
- int GetY() {
- return y;
- }
- void AddChampionOnSquare(Champion Object) {
- for (Pair<Champion, Player> PP : ChampionsInSquare) {
- if (PP.getValue() == Move.staticCurrentPlayer) {
- Object.SetPosition(x + 1, y + 1);
- Arena.OneSquare[x + 1][y + 1].AddChampionOnSquare(Object);
- return;
- }
- }
- ChampionsInSquare.add(new Pair<>(Object, Move.staticCurrentPlayer));
- }
- void RemoveChampionFromSquare(Champion Object) {
- for (int i = 0; i < ChampionsInSquare.size(); i++) {
- if (ChampionsInSquare.get(i).getKey() == Object) {
- ChampionsInSquare.remove(i);
- break;
- }
- }
- }
- @Override
- public String toString() {
- return x + " - " + y;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement