public void PlayerDirectionHit(int nr)
        {
            ConfirmationScreenIn();
            Vector3 rotation = new Vector3(0, 0, GlobalMethods.GetDirectionRotation(_playerController.GetMoves()[nr]));

            LeanTween.rotateLocal(directionImage.gameObject, rotation, 0.3f).setEase(LeanTweenType.easeOutSine);
            _directionOffer = _playerController.GetMoves()[nr];
        }
示例#2
0
        private void AddMove(StoredPlayerMove move)
        {
            //Image img = transform.GetChild(_nrOfMovesInSequence).GetComponent<Image>();
            //img.color = ColorPalette.current.GetPlayerColor(move.PlayerTags);

            Image img = GetElement(_nrOfMovesInSequence).GetComponent <SequenceArrowController>().image;

            img.color = ColorPalette.current.GetPlayerColor(move.PlayerTags);

            GetElement(_nrOfMovesInSequence).GetComponent <SequenceArrowController>().index = _nrOfMovesInSequence;
            GetElement(_nrOfMovesInSequence).GetComponent <SequenceArrowController>().move  = move;


            GetElement(_nrOfMovesInSequence).GetComponent <Button>().interactable = GUIEvents.current.GetCurrentPlayer() == move.PlayerTags;
            GetElement(_nrOfMovesInSequence).GetComponent <SequenceArrowController>().SetMouseHover(GUIEvents.current.GetCurrentPlayer() == move.PlayerTags);
            GetElement(_nrOfMovesInSequence).GetComponent <SequenceArrowController>().SetCancelButtonActive(GUIEvents.current.GetCurrentPlayer() == move.PlayerTags);


            LeanTween.color(img.rectTransform, ColorPalette.current.GetPlayerColor(move.PlayerTags), 0.3f).setEase(LeanTweenType.easeOutSine);

            int     rotationZ = GlobalMethods.GetDirectionRotation(move.Direction);
            Vector3 rotation  = new Vector3(0, 0, rotationZ);

            Vector3 reverseRotation;

            if (rotationZ == 90 || rotationZ == -90)
            {
                reverseRotation = new Vector3(0, 0, rotationZ * -1);
            }

            if (rotationZ == 180)
            {
                reverseRotation = new Vector3(0, 0, 0);
            }
            else
            {
                reverseRotation = new Vector3(0, 0, 180);
            }


            img.gameObject.transform.rotation = Quaternion.Euler(reverseRotation);

            LeanTween.rotateLocal(img.gameObject, rotation, 0.3f).setEase(LeanTweenType.easeOutSine);
            _nrOfMovesInSequence++;
        }
示例#3
0
        public void SetInfo(PlayerTrade trade, PlayerController playerController)
        {
            _trade            = trade;
            _playerController = playerController;
            GlobalMethods.UpdateArrows(arrowPanel.transform, _playerController);
            _playerController.AddInventoryObserver(this);

            text.text = $"{_trade.OfferingPlayerTags}\nTrading\n{_trade.DirectionOffer}";

            offeringPlayerBorder.color  = ColorPalette.current.GetPlayerColor(_trade.OfferingPlayerTags);
            receivingPlayerBorder.color = ColorPalette.current.GetPlayerColor(_trade.ReceivingPlayerTags);
            fadeController.SetPauseColor(ColorPalette.current.GetPlayerColor(trade.ReceivingPlayerTags));


            Vector3 rotation = new Vector3(0, 0, GlobalMethods.GetDirectionRotation(_trade.DirectionOffer));

            LeanTween.rotateLocal(incomingDirection.gameObject, rotation, 0.3f).setEase(LeanTweenType.easeOutSine);
        }
示例#4
0
        private void RemoveMove(StoredPlayerMove move)
        {
            List <StoredPlayerMove> moves = GameHandler.Current.GetSequence();
            int i = 0;

            foreach (StoredPlayerMove playerMove in moves)
            {
                SequenceArrowController arrowController = GetElement(i).GetComponent <SequenceArrowController>();
                Transform element = GetElement(i);
                i++;
                if (arrowController.move.Id == playerMove.Id)
                {
                    continue;
                }

                arrowController.move = playerMove;

                Image img = arrowController.image;

                element.GetComponent <Button>().interactable = GUIEvents.current.GetCurrentPlayer() == playerMove.PlayerTags;
                element.GetComponent <SequenceArrowController>().SetCancelButtonActive(GUIEvents.current.GetCurrentPlayer() == playerMove.PlayerTags);
                element.GetComponent <SequenceArrowController>().SetMouseHover(GUIEvents.current.GetCurrentPlayer() == playerMove.PlayerTags);

                //Rotation stuff
                LeanTween.color(img.rectTransform, ColorPalette.current.GetPlayerColor(playerMove.PlayerTags), 0.3f).setEase(LeanTweenType.easeOutSine);


                Vector3 rotation = new Vector3(0, 0, GlobalMethods.GetDirectionRotation(playerMove.Direction));
                LeanTween.rotateLocal(img.gameObject, rotation, 0.3f).setEase(LeanTweenType.easeOutSine);
            }

            for (int j = i; j < _nrOfMovesInSequence; j++)
            {
                Image img = GetElement(i).GetComponent <SequenceArrowController>().image;
                GetElement(i).GetComponent <SequenceArrowController>().SetCancelButtonActive(false);
                GetElement(i).GetComponent <Button>().interactable = false;

                LeanTween.color(img.rectTransform, idleColor, 0.3f);
            }

            _nrOfMovesInSequence--;
        }
示例#5
0
        public void OnArrowButtonHit(int nr)
        {
            counterOfferImage.sprite = directionArrowSprite;

            Vector3 rotation = new Vector3(0, 0, GlobalMethods.GetDirectionRotation(_playerController.GetMoves()[nr]));

            LeanTween.rotateLocal(counterOfferImage.gameObject, rotation, 0);

            _counterOffer = _playerController.GetMoves()[nr];

            HideArrows();

            //Moving buttons into pos
            LeanTween.moveLocalX(rejectButton, -10, 0.4f).setEase(LeanTweenType.easeOutQuad);

            //LeanTween.moveLocalY(rejectButton, 17, 0.4f).setEase(LeanTweenType.easeOutQuad);

            LeanTween.moveLocalX(acceptButton, 17, 0.4f).setEase(LeanTweenType.easeOutQuad);

            LeanTween.moveLocalX(tradePanel, 15, 0.4f).setEase(LeanTweenType.easeInOutQuad);

            _rejectButtonHideOnMouseExit = false;
            fadeController.ResetToWhite();
        }