private void ReceiveBuff(NetworkViewID playerId, Vector3 tilePosition, int rollResult) { var character = GameManager.GetCharacterManager(playerId).GetCharacterInstance(); character.SetBuffOrDeBuff(rollResult); MultiAudioClip multiAudioClip = character.GetComponent <MultiAudioClip>(); multiAudioClip.audioSources[0].Play(); BattleUIManager.Get().ShowBuffStartAnimation(playerId, tilePosition); }
public void SetPortrait() { Option <Sprite> portraitSprite = Slinqable.Slinq(BattleUIManager.Get().leftUI.classSprite) .FirstOrNone((classSprite) => classSprite.charClass == this.charClass) .Select((classSprite) => classSprite.sprite); portraitSprite.ForEachOr( (sprite) => this.portrait.sprite = sprite, () => Debug.LogError("Cannot find sprite for left ui.") ); }
public void SetHp(int currentHp) { if (currentHp < 1) { life.enabled = false; } else { life.enabled = true; var imageIndex = currentHp - 1; life.sprite = BattleUIManager.Get().heartSprites[imageIndex]; } }
public Run ShowItemAcquisitionEffect(Vector3 position, Character.Item item) { var effect = Instantiate(itemAcquisitionEffectPrefab, position, Quaternion.identity) as GameObject; effect.transform.parent = BattleUIManager.Get().transform; effect.transform.localPosition = Vector3.zero; var itemSprite = BattleUIManager.Get().GetSpriteOfItem(item); effect.GetComponentInChildren <SpriteRenderer>().sprite = itemSprite; return(Run.WaitWhile(() => effect != null)); }
private void ReceiveTurnStartMessage(NetworkViewID nextPlayerId) { BattleUIManager.Get().SetPlayerTurn(nextPlayerId); GameManager.GetCharacterManager(nextPlayerId).CameraFollow(); if (NetworkManager.networkInstance.Id == nextPlayerId) { GameManager.GetMyCharacterManager().ChangeMoveStateToIdle(); Debug.Log("My turn"); } else { Debug.Log("Not My turn"); } }
public void SetBuff(bool isBuff, int turn) { if (turn < 1) { buff.enabled = false; return; } else { buff.enabled = true; } var buffSpriteIndex = 3; // transparent background. if (turn >= 3) { buffSpriteIndex = 0; } else if (turn == 2) { buffSpriteIndex = 1; } else if (turn == 1) { buffSpriteIndex = 2; } var uiManager = BattleUIManager.Get(); if (isBuff) { buff.sprite = BattleUIManager.Get().buffSprites[buffSpriteIndex]; } else { buff.sprite = BattleUIManager.Get().deBuffSprites[buffSpriteIndex]; } }
private void ReceiveUseItem(string strItem) { Character.Item item = (Character.Item)Enum.Parse(typeof(Character.Item), strItem); BattleUIManager.Get().ReceivedUseItemCard(item); }
private void ReceiveShowEnemyTurn() { BattleUIManager.Get().ShowEnemyTurn(); }
private void ReceiveSyncTurnCount(int turnCount) { BattleUIManager.Get().SetTurnCount(turnCount); }
private void ReceiveStartEnemyTurn() { BattleUIManager.Get().SetEnemyTrn(); }
IEnumerator OnMouseDrag() { if (waitingAnimation != null && !waitingAnimation.isDone) { yield break; } Vector3 startPoint = transform.position; SetInitialState(); Vector3 currentPosition = transform.position; Vector3 screenPoint = BattleUIManager.Get().uiCamera.WorldToScreenPoint(transform.position); Vector3 mousePoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z); yield return(null); while (Input.GetMouseButton(0)) { if (state == State.Closing) { if (CheckDraggedEnoughToClose()) { Close(); yield break; } } else { if (CheckDraggedEnoughToOpen()) { Open(); yield break; } } Vector3 curMousePoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z); Vector3 diffScreenPoint = curMousePoint - mousePoint; Vector3 newScreenPoint = screenPoint + diffScreenPoint; Vector3 newPosition = BattleUIManager.Get().uiCamera.ScreenToWorldPoint(newScreenPoint); transform.position = new Vector3(newPosition.x, transform.position.y, transform.position.z); transform.localPosition = new Vector3( Mathf.Clamp(transform.localPosition.x, openedXPos, closedXPos), transform.localPosition.y, transform.localPosition.z); screenPoint = BattleUIManager.Get().uiCamera.WorldToScreenPoint(transform.position); mousePoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z); yield return(null); } if (state == State.Closing) { if (CheckDraggedEnoughToClose()) { Close(); yield break; } } else { if (CheckDraggedEnoughToOpen()) { Open(); yield break; } } }
public void AddItem(Character.Item newItem) { inventory.Add(newItem); BattleUIManager.Get().AddItemCard(newItem); Debug.Log("Get " + newItem.ToString() + " / Inventory : " + GetNumberOfItems() + " / 3"); }
public void Initialize() { ui = BattleUIManager.Get().GetPlayerUI(playerId); }
public void OnButtonClicked() { BattleUIManager.Get().UseItemCard(item); Debug.Log("Item card cicked."); }
public void SetTurnOrder(List <NetworkViewID> playerOrder) { BattleUIManager.Get().SetPlayers(playerOrder, playerClasses); }