Пример #1
0
    internal void SetOwner(TownHouseSlot activeSlot, PlayerController newOwner)
    {
        if (newOwner != null && newOwner)
        {
            var owningSlot = slots.FirstOrDefault(x => x.Owner?.UserId == newOwner.UserId);
            if (owningSlot)
            {
                owningSlot.SetOwner(null);
            }
        }

        activeSlot.SetOwner(newOwner);
    }
Пример #2
0
    internal void SetOwner(TownHouseSlot activeSlot, PlayerController newOwner)
    {
        if (slots == null || slots.Length == 0)
        {
            return;
        }

        if (newOwner != null && newOwner)
        {
            var owningSlot = slots.FirstOrDefault(x => x.Owner?.UserId == newOwner.UserId);
            if (owningSlot != null && owningSlot)
            {
                owningSlot.SetOwner(null);
            }
        }

        if (!activeSlot || activeSlot == null)
        {
            return;
        }

        activeSlot.SetOwner(newOwner);
    }