Beispiel #1
0
    public override void StartTurn()
    {
        base.StartTurn();

        ChooseCardInOrder();
        chosenDiceRoll = diceroll.RollRandom();

        var pos = chosenCardPos.position;
        var rot = Quaternion.Euler(0f, 0f, Random.Range(-5f, 5f));

        chosenCard.transform.localScale = Vector3.one;

        StartCoroutine(Math3D.CardAnim(chosenCard.gameObject, new Vector3(pos.x, pos.y, -1f), rot, 0.25f));
    }
Beispiel #2
0
    public void GrantNewCard(Card card)
    {
        uiController.ShowNewCardUI();
        var camPos = new Vector3(_cam.transform.position.x, _cam.transform.position.y, 0f);

        player.transform.position   = camPos;
        opponent.transform.position = camPos;

        Quaternion newCardStartRot = Quaternion.Euler(0f, 0f, Random.Range(-15f, 15f));
        Quaternion newCardEndRot   = Quaternion.Euler(0f, 0f, Random.Range(-5f, 5f));
        Vector3    newCardStartPos = new Vector3(Random.Range(-8f, 8f), Random.Range(-5f, 5f), 0f) + camPos;

        var obj = Instantiate(card, newCardStartPos, newCardStartRot, player.transform);

        grantedCard = obj;

        StartCoroutine(Math3D.CardAnim(obj.gameObject, camPos, newCardEndRot, 0.15f));
    }
Beispiel #3
0
    private IEnumerator StartTurnCoroutine()
    {
        ChooseCardAtRandom();

        var pos = chosenCardPos.position;
        var rot = Quaternion.Euler(0f, 0f, Random.Range(-5f, 5f));

        chosenCard.transform.localScale = Vector3.one;

        // this nested coroutine is to allow the anims to play before ending game
        yield return(StartCoroutine(Math3D.CardAnim(chosenCard.gameObject, new Vector3(pos.x, pos.y, -1f), rot, 0.25f)));

        yield return(new WaitForSeconds(0.5f));

        // check if we have rolls left and end battle if not
        if (diceroll.rollsRemaining.Count <= 0)
        {
            _turnManager.EndBattle(this, true);
        }
    }