/// <summary> /// Called when a player enters the VIP zone /// </summary> /// <param name="player">The player that entered it</param> internal void PlayerEnteredZone(FollowBackInputHandler player) { // add player to the list, unless it was the active player if (player != _currentInfluencer) { _playersInZone.Add(player); } }
/// <summary> /// Sets the values to display /// </summary> /// <param name="pl">The player info to display</param> internal void Initialise(FollowBackInputHandler pl) { TxtNumFollowers.text = pl.GetFollowerCount().ToString(); TxtPlayerName.text = "@" + pl.GetPlayerName(); PlayerSprite.sprite = FollowBackController.Instance.CharacterSprites[pl.GetCharacterIndex()]; PlayerSpriteBg.color = ColourFetcher.GetColour(pl.GetPlayerIndex()); PlayerSpriteBgRing.color = ColourFetcher.GetColour(pl.GetPlayerIndex()); }
/// <summary> /// Randomly selects an influencer from list of players who are yet to have all their turns /// </summary> private IEnumerator SelectInfluencer_() { // briefly wait yield return(new WaitForSeconds(3)); // clear round counts foreach (var pl in _players) { pl.NewRound(); } ResetSpriteImage_(); // show trending panel TrendingPanel.SetActive(true); // flick through each player for (int i = 0; i < 50; i++) { TxtTrendingMessage.text = "@" + _players[i % _players.Count].GetPlayerName(); ImgInfluencer.sprite = CharacterSprites[_players[i % _players.Count].GetCharacterIndex()]; ImgInfluencerBG.color = ColourFetcher.GetColour(i % _players.Count); yield return(new WaitForSeconds(0.1f)); } // ensure the list is empty _playersInZone.Clear(); // pick a random player var r = UnityEngine.Random.Range(0, _remainingTurns.Count); _currentInfluencer = _players[_remainingTurns[r]]; _remainingTurns.RemoveAt(r); // display selection TxtTrendingMessage.text = "@" + _currentInfluencer.GetPlayerName(); ImgInfluencer.sprite = CharacterSprites[_currentInfluencer.GetCharacterIndex()]; ImgInfluencerBG.color = ColourFetcher.GetColour(_currentInfluencer.GetPlayerIndex()); // show zone InfluencerZone.gameObject.SetActive(true); InfluencerZone.SetParent(_currentInfluencer.MovementObject()); InfluencerZone.localPosition = new Vector3(0, 0, 2f); // increase size StartCoroutine(GrowZone_()); // start timer _turnLimit.StartTimer(); _turnRunning = true; StartCoroutine(CheckZone_()); }
/// <summary> /// Adds an item to a vidiprinter /// </summary> public void AddVidiprinterItem(FollowBackInputHandler player, string message) { // shift content for (int i = 3; i >= 1; i--) { VidiprinterItems[i].Initialise(VidiprinterItems[i - 1]); } // display new message VidiprinterItems[0].Initialise(player, message); }
/// <summary> /// Sets the player to attack and position /// <summary> /// <param id="vic">The player to attack</param> /// <param id="index">The index of the player</param> public void Setup(FollowBackInputHandler vic, int index) { Renderer.enabled = false; _victim = vic; // randomly adjust position, so that they are not all in front of each other var offset = UnityEngine.Random.Range(-0.2f, 0.2f); transform.Translate(new Vector3(offset, offset, -1 + (0.1f * index))); Renderer.flipX = offset > 0; // appear in a puff of smoke StartCoroutine(Appear_()); }
/// <summary> /// Initialises the display /// </summary> /// <param name="player">The player that this relates to</param> /// <param name="message">The message to show</param> public void Initialise(FollowBackInputHandler player, string message) { TxtDescription.text = message; if (player != null) { ImgPlayerImageBG.gameObject.SetActive(true); ImgPlayerImage.sprite = FollowBackController.Instance.CharacterSprites[player.GetCharacterIndex()]; ImgPlayerImageBG.color = ColourFetcher.GetColour(player.GetPlayerIndex()); } else { ImgPlayerImageBG.gameObject.SetActive(false); } gameObject.SetActive(true); Initialised = true; }
/// <summary> /// Sets the content of the selfie /// </summary> /// <param id="players">The players in the selfie</param> public void Setup(Tuple <FollowBackInputHandler, FollowBackInputHandler> players) { _owner = players.Item1; // set background image var randomBackground = UnityEngine.Random.Range(0, BackgroundSprites.Length); ImgBackground.sprite = BackgroundSprites[randomBackground]; // set player images ImgTaker.sprite = TakerSprites[_owner.GetCharacterIndex()]; ImgSubject.sprite = SubjectSprites[players.Item2.GetCharacterIndex()]; // set text diplays TxtUsername.text = "@" + _owner.GetPlayerName(); TxtCaption.text = GetCaption_() + " <i>@" + players.Item2.GetPlayerName() + " </i><color=#4062B7>" + GetHashtags_() + "</color>"; gameObject.SetActive(true); }
/// <summary> /// Stores a selfie for specified player /// </summary> /// <param name="player">The player who took the selfie</param> public void SelfieTaken(FollowBackInputHandler player) { _selfies.Add(new Tuple <FollowBackInputHandler, FollowBackInputHandler>(player, _currentInfluencer)); AddVidiprinterItem(player, $" took a selfie"); }
/// <summary> /// Called when a player leaves the VIP zone /// </summary> /// <param name="player">The player that left it</param> internal void PlayerLeftZone(FollowBackInputHandler player) { _playersInZone.Remove(player); }
/// <summary> /// Updates the UI display of the player /// </summary> /// <param name="player">The player to update</param> public void UpdatePlayerUIs(FollowBackInputHandler player) { // update UIs PlayerUiDisplays[player.GetPlayerIndex()].SetFollowerCount(player.GetFollowerCount()); }
/// <summary> /// Check if a player is in the active zone /// </summary> /// <param name="player">The player to check</param> /// <returns>Whether the player is in the zone</returns> public bool PlayerInZone(FollowBackInputHandler player) { return(_playersInZone.Any(p => p == player)); }