Example #1
0
    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);
    }
Example #2
0
        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.")
                );
        }
Example #3
0
 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];
     }
 }
Example #4
0
    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));
    }
Example #5
0
    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");
        }
    }
Example #6
0
        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];
            }
        }
Example #7
0
 private void ReceiveUseItem(string strItem)
 {
     Character.Item item = (Character.Item)Enum.Parse(typeof(Character.Item), strItem);
     BattleUIManager.Get().ReceivedUseItemCard(item);
 }
Example #8
0
 private void ReceiveShowEnemyTurn()
 {
     BattleUIManager.Get().ShowEnemyTurn();
 }
Example #9
0
 private void ReceiveSyncTurnCount(int turnCount)
 {
     BattleUIManager.Get().SetTurnCount(turnCount);
 }
Example #10
0
 private void ReceiveStartEnemyTurn()
 {
     BattleUIManager.Get().SetEnemyTrn();
 }
Example #11
0
    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;
            }
        }
    }
Example #12
0
 public void AddItem(Character.Item newItem)
 {
     inventory.Add(newItem);
     BattleUIManager.Get().AddItemCard(newItem);
     Debug.Log("Get " + newItem.ToString() + " / Inventory : " + GetNumberOfItems() + " / 3");
 }
Example #13
0
 public void Initialize()
 {
     ui = BattleUIManager.Get().GetPlayerUI(playerId);
 }
Example #14
0
 public void OnButtonClicked()
 {
     BattleUIManager.Get().UseItemCard(item);
     Debug.Log("Item card cicked.");
 }
Example #15
0
 public void SetTurnOrder(List <NetworkViewID> playerOrder)
 {
     BattleUIManager.Get().SetPlayers(playerOrder, playerClasses);
 }