Gruppe22.Backend.Map.AssignPlayer C# (CSharp) Метод

AssignPlayer() публичный Метод

Method to add the player character in the current map(room)
public AssignPlayer ( string GUID = "" ) : int
GUID string
Результат int
        public virtual int AssignPlayer(string GUID = "")
        {
            Coords tempCoords = new Coords(1, 1);
            for (int i = 0; i < _actors.Count; ++i)
            {
                if ((_actors[i] is Player) && ((_actors[i].GUID == "") || (_actors[i].GUID == GUID)))
                {
                    _actors[i].GUID = GUID;
                    _actors[i].online = true;
                    tempCoords = _actors[i].tile.coords;
                    return i;
                }
            }
            Player temp = new Player();
            _actors.Add(temp);
            temp.id = _actors.Count - 1;
            int newID = _actors.Count - 1;
            temp.online = true;
            temp.tile = new ActorTile(this[tempCoords], temp);
            this[tempCoords].Add(temp.tile);
            return newID;
            // Create New Player with specified GUID
        }