Пример #1
0
 public RoundEndPhase(PhaseHandler ph, Action a)
 {
     PH  = ph;
     act = a;
     Debug.Log(a.SUBJECT.name + "'s " + "EndPhase");
     doneFirstFrame = false;
 }
Пример #2
0
 void Start()
 {
     ph                         = (PhaseHandler)FindObjectOfType(typeof(PhaseHandler));
     cloudFade                  = GameObject.Find("Cloud Fade");
     transform.position         = new Vector2(0f.AddRandVal(-5, -2), GameMaster.instance.screenBottomEdge);
     transform.localEulerAngles = new Vector3(transform.rotation.x, transform.rotation.y, 25);
     LeanTween.moveY(gameObject, waitHeight, 1f).setEase(LeanTweenType.easeOutCubic);
     LeanTween.rotate(gameObject, new Vector3(0, 0, 0), 1f).setEase(LeanTweenType.easeOutCubic);
 }
Пример #3
0
    public void DoAction()
    {
        PlayerProperties targetPlayer;

        if (player.IsAiPlayer)
        {
            print("Player is an AI, selecting random weapon and target now");
            // won't set the targetRow/Weapon in PlayerProperties, but will attack the correct random player with the random weapon
            //var decisionPhase = gameObject.GetComponent<DecisionPhase>();
            //var actionPhase = gameObject.GetComponent<ActionPhase>();

            // choose a random valid(!) target player
            var randomTargetRow = GetRandomTargetRow();
            targetPlayer = GetTargetPlayer(randomTargetRow);

            // and a random weapon
            ChangeLeftHandWeapon(randomTargetRow, GetRandomWeapon());
        }

        else
        {
            targetPlayer = GetTargetPlayer();
        }

        // checks for restrictions before attacking
        if (CanPlayerAttack(targetPlayer))
        {
            // TODO check if player is front or back row to choose whether player should move or throw weapon
            // -> front should move and swing weapon, back should throw weapon
            if (player.CurrentRowPosition == PhaseHandler.RowPosition.Back)
            {
                Coroutine throwWeaponCoroutine = StartCoroutine(ThrowWeapon(targetPlayer, onComplete: () => {
                    DealDamage(targetPlayer);
                    LoadNewEffect(new Vector3(2f, 2f, 2f), targetPlayer);
                    PhaseHandler.SetNextActivePlayer();
                }));
            }

            else
            {
                MoveToAttackTarget(targetPlayer);
            }
        }
        else
        {
            print($"target ({targetPlayer.playerName}) can currently not be attacked. Switching to next player now.");
            // somehow this has to be done via callback, otherwise the next phase won't be triggered
            // PhaseHandler.SetNextActivePlayer();
            // StartCoroutine(SetNextActivePlayer(onComplete: () => { PhaseHandler.SetNextActivePlayer(); }));

            MinifigControllerGroupW.SpecialAnimation specialAnimation = player.currentHp <= 0 ? MinifigControllerGroupW.SpecialAnimation.LookingDown : MinifigControllerGroupW.SpecialAnimation.IdleImpatient;

            playerMinifigController.PlaySpecialAnimation(specialAnimation, onSpecialComplete: (x) => {
                PhaseHandler.SetNextActivePlayer();
            });
        }
    }
Пример #4
0
    void RotateBack(PlayerProperties activePlayer, PlayerProperties targetPlayer)
    {
        // TODO player hp bar should stay on top of player instead of rotating with him
        // face to the correct direction again (change rotation)
        print("now rotating back");
        Vector3 originalRotation = targetPlayer.transform.position;

        // when the animation is finished, it's the next players turn
        playerMinifigController.TurnTo(originalRotation, onComplete: () => { PhaseHandler.SetNextActivePlayer(); });
    }
Пример #5
0
        public void Update()
        {
            if (InputHandler.LeftButtonReleased)
            {
                var point      = InputHandler.Position;
                var screenPart = ScreenManager.GetClickedScreenPart(point.ToPoint());
                // 576x576
                switch (screenPart)
                {
                case ScreenPart.Gameboard:
                {
                    if (PhaseHandler.GamePhase == Phase.Spellcasting)
                    {
                        var tile          = gameboard.GetTile(point.ToPoint());
                        var currentPlayer = PhaseHandler.CurrentPlayer;
                        var selectedSpell = currentPlayer.SelectedSpell;
                        if (selectedSpell == null)
                        {
                            Log.Debug($"{currentPlayer.Name} has not selected any spell.");
                            PhaseHandler.ChangeTurn();
                            break;
                        }

                        tile.animationType = SpellAnimationType.Casting;
                        tile.Update(Spellcasting.Creation(currentPlayer.SelectedSpell));
                        Log.Debug(
                            $"{currentPlayer.Name} is trying to cast spell {selectedSpell.Name} at POS: {tile.Position}");
                        PhaseHandler.ChangeTurn();
                    }
                    break;
                }

                case ScreenPart.Spellboard:
                    Log.Debug($"Player {PhaseHandler.CurrentPlayer.Name} is now picking a spell!");
                    var spellTile = spellboard.GetSpellTile(point.ToPoint());
                    PhaseHandler.CurrentPlayer.SelectedSpell = spellTile.Spell;
                    SoundPlayer.PlaySound(SoundType.Click);
                    Log.Debug($"Player {PhaseHandler.CurrentPlayer.Name} has selected {spellTile.Spell.Name}");
                    PhaseHandler.ChangeTurn();
                    break;

                case ScreenPart.Undefined:
                    break;
                }
            }
        }
Пример #6
0
        public void Update()
        {
            if (InputHandler.LeftButtonReleased)
            {
                var point      = InputHandler.Position;
                var screenPart = GetClickedScreenPart(point.ToPoint());
                // 576x576
                switch (screenPart)
                {
                case ScreenPart.EndTurnButton:
                    PhaseHandler.ChangeTurn();
                    return;

                case ScreenPart.Undefined:
                    break;
                }
            }
        }
Пример #7
0
 public RoundBeginPhase(PhaseHandler ph, Action a)
 {
     PH  = ph;
     act = a;
     Debug.Log(a.SUBJECT.name + "'s " + "BeginPhase");
 }
Пример #8
0
 public WaitingPhase(PhaseHandler ph, Action a)
 {
     PH  = ph;
     act = a;
     Debug.Log(a.SUBJECT.name + "'s " + "WaitingPhase");
 }
Пример #9
0
 public void setPhaseHandler(PhaseHandler ch)
 {
     phaseHandler = ch;
 }