コード例 #1
0
        // PRAGMA MARK - Public Interface
        public void Init(BattlePlayerSkin skin)
        {
            skin_ = skin;
            thumbnailImage_.sprite = skin_.ThumbnailSprite;

            StateSkinCustomization.OnSelectedSkinsDirty += RefreshSelected;
            RefreshSelected();
        }
コード例 #2
0
        // PRAGMA MARK - Static Public Interface
        public static BattlePlayerSkin GetBestRandomSkin()
        {
            BattlePlayerSkin[] skins = GameConstants.Instance.PlayerSkins;

            BattlePlayerSkin chosenSkin = skins.Random();

            // NOTE (darren): could do a better random here..
            while (SkinAlreadyInUse(chosenSkin) && !skins.All(SkinAlreadyInUse))
            {
                chosenSkin = skins.Random();
            }

            return(chosenSkin);
        }
コード例 #3
0
        private void HandleSelectableSelected(ISelectable selectable)
        {
            BattlePlayerSkin skin = (selectable as SkinSelectable).Skin;

            // if any player has already selected this skin, we cannot select it
            // if all skins are selected then we ignore this check
            if (IsSkinSelected(skin) && !GameConstants.Instance.PlayerSkins.All(s => IsSkinSelected(s)))
            {
                AudioConstants.Instance.Negative.PlaySFX();
                return;
            }

            Player_.Skin = skin;
            MoveToNextState();
        }
コード例 #4
0
 // PRAGMA MARK - Static Internal
 private static bool SkinAlreadyInUse(BattlePlayerSkin skin)
 {
     return(RegisteredPlayers.AllPlayers.Any(p => p.Skin == skin));
 }
コード例 #5
0
 public static bool IsSkinSelected(BattlePlayerSkin skin)
 {
     return(RegisteredPlayers.AllPlayers.Where(p => IsPlayerNotSelectingSkin(p)).Any(p => p.Skin == skin));
 }