Beispiel #1
0
    public void OnStopped()
    {
        Random.InitState((int)System.DateTime.Now.Ticks);
        int diceRoll = Random.Range(1, 7);

        GameObject.Find("ClickTheDice").GetComponent <Text>().text = "DICE VALUES: ";

        if (DiceManager.APFound() == false)
        {
            GameObject ap = DiceManager.FindEmptyTypeTotal();
            ap.GetComponent <Text>().text = "AP: ";
            ap.transform.GetChild(0).GetComponent <Text>().enabled = true;
            DiceManager.SetAPFound(true);
        }

        string rollValueName = "RollValue" + Dice.LastDiceClicked().name.ToCharArray()[Dice.LastDiceClicked().name.Length - 1];

        GameObject.Find(rollValueName).GetComponent <Text>().text = diceRoll.ToString();

        int rollTotal = int.Parse(GameObject.Find("RollTotal").GetComponent <Text>().text);

        rollTotal += diceRoll;
        GameObject.Find("RollTotal").GetComponent <Text>().text    = rollTotal.ToString();
        GameObject.Find("RollTotal").GetComponent <Text>().enabled = true;

        int attackTotal = int.Parse(DiceManager.FindTypeTotalGameObject("AP").transform.GetChild(0).GetComponent <Text>().text);

        attackTotal += diceRoll;
        DiceManager.FindTypeTotalGameObject("AP").transform.GetChild(0).GetComponent <Text>().text = attackTotal.ToString();

        if (diceRoll == 1)
        {
            GameObject.Find("AttackMissed").GetComponent <BillboardMessage>().ShowMessage();
        }
    }
Beispiel #2
0
    public void OnStopped()
    {
        Random.InitState((int)System.DateTime.Now.Ticks);
        int diceRoll = Random.Range(1, 4);

        GameObject.Find("ClickTheDice").GetComponent <Text>().text = "DICE VALUES: ";

        FreezeOnRoll(diceRoll);

        if (DiceManager.APFound() == false)
        {
            GameObject ap = DiceManager.FindEmptyTypeTotal();
            ap.GetComponent <Text>().text = "AP: ";
            ap.transform.GetChild(0).GetComponent <Text>().enabled = true;

            if (!TurnManager.GetCurrTurnCharacter().tag.Contains("Enemy"))
            {
                GameObject.Find("ConfirmAttackButton").GetComponent <CustomButton>().Enable();
            }

            DiceManager.SetAPFound(true);
        }

        string rollValueName = "RollValue" + Dice.LastDiceClicked().name.ToCharArray()[Dice.LastDiceClicked().name.Length - 1];

        GameObject.Find(rollValueName).GetComponent <Text>().text = diceRoll.ToString();

        int rollTotal = int.Parse(GameObject.Find("RollTotal").GetComponent <Text>().text);

        int rollAdd = rollTotal * diceRoll - rollTotal;

        rollTotal *= diceRoll;

        GameObject.Find("RollTotal").GetComponent <Text>().text    = rollTotal.ToString();
        GameObject.Find("RollTotal").GetComponent <Text>().enabled = true;

        int attackTotal = int.Parse(DiceManager.FindTypeTotalGameObject("AP").transform.GetChild(0).GetComponent <Text>().text);

        attackTotal += rollAdd;
        DiceManager.FindTypeTotalGameObject("AP").transform.GetChild(0).GetComponent <Text>().text = attackTotal.ToString();
    }
    public void OnStopped()
    {
        Random.InitState((int)System.DateTime.Now.Ticks);



        int diceRoll = DiceRollCalculator.CalculateDiceRollSix();

        GameObject.Find("ClickTheDice").GetComponent <Text>().text = "DICE VALUES: ";

        if (TurnManager.GetCurrTurnCharacter().tag.Contains("Enemy") && TutorialManager.IsTutorial())
        {
            if (TutorialManager.LastTutorialShown())
            {
                diceRoll = 1;
            }
            else
            {
                diceRoll = 6;
            }
        }
        else if (diceRoll == 1)
        {
            if (DiceManager.GetNumPlayerRolls() <= 3)
            {
                diceRoll = 2;
            }

            if (!DiceManager.CanCurrentlyRollOne())
            {
                diceRoll = 2;
            }
        }

        if (TutorialManager.IsTutorial() && TutorialManager.FirstDiceRolled())
        {
            if (DiceManager.GetNumPlayerRolls() == 2)
            {
                diceRoll = 1;
            }
        }

        if (TurnManager.GetCurrTurnCharacter().tag.Contains("Player"))
        {
            DiceManager.IncreaseNumPlayerRolls();
        }

        FreezeOnRoll(diceRoll);

        if (DiceManager.APFound() == false)
        {
            GameObject ap = DiceManager.FindEmptyTypeTotal();
            ap.GetComponent <Text>().text = "AP: ";
            ap.transform.GetChild(0).GetComponent <Text>().enabled = true;

            if (!TurnManager.GetCurrTurnCharacter().tag.Contains("Enemy"))
            {
                GameObject.Find("ConfirmAttackButton").GetComponent <CustomButton>().Enable();
            }

            DiceManager.SetAPFound(true);
        }

        string rollValueName = "RollValue" + Dice.LastDiceClicked().name.ToCharArray()[Dice.LastDiceClicked().name.Length - 1];

        GameObject.Find(rollValueName).GetComponent <Text>().text = diceRoll.ToString();

        //int rollTotal = int.Parse(GameObject.Find("RollTotal").GetComponent<Text>().text);
        //rollTotal += diceRoll;
        //GameObject.Find("RollTotal").GetComponent<Text>().text = rollTotal.ToString();
        //GameObject.Find("RollTotal").GetComponent<Text>().enabled = true;

        int attackTotal = int.Parse(DiceManager.FindTypeTotalGameObject("AP").transform.GetChild(0).GetComponent <Text>().text);

        attackTotal += diceRoll;
        DiceManager.FindTypeTotalGameObject("AP").transform.GetChild(0).GetComponent <Text>().text = attackTotal.ToString();
        DiceManager.FindTypeTotalGameObject("AP").GetComponent <TextPulseTypeTotals>().Pulse();

        if (diceRoll == 1)
        {
            DiceManager.DisableAllButtons();
            GameObject.Find("ConfirmAttackButton").GetComponent <CustomButton>().Disable();
            GameObject.Find("AttackMissed").GetComponent <BillboardMessage>().ShowMessage();
        }

        GameObject.Find("AttackHolder").GetComponent <AttackHolder>().AddAttack(diceRoll, "Common", diceRoll);
    }