Exemplo n.º 1
0
    // ROLL

    public void Roll(DelegateDiceroll callBack)
    {
        DiceRoll.CurrentDiceRoll = this;
        this.CallBack            = callBack;

        if (!ShouldSkipToSync())
        {
            if (!DebugManager.BatchAiSquadTestingModeActive)
            {
                foreach (Die die in DiceList)
                {
                    die.RandomizeRotation();
                }
                RollPreparedDice();
            }
            else
            {
                System.Random random = new System.Random();
                DieSide[]     sides  = PossibleSides[Type];
                foreach (Die die in DiceList)
                {
                    die.TrySetSide(sides[random.Next(0, 8)], isInitial: true);
                }

                Roster.GetPlayer(Phases.CurrentSubPhase.RequiredPlayer).SyncDiceResults();
                Phases.CurrentSubPhase.IsReadyForCommands = true;
            }
        }
        else
        {
            Roster.GetPlayer(Phases.CurrentSubPhase.RequiredPlayer).SyncDiceResults();
            Phases.CurrentSubPhase.IsReadyForCommands = true;
        }
    }
Exemplo n.º 2
0
    public void RerollSelected(DelegateDiceroll callBack)
    {
        this.callBack = callBack;

        if (ReplaysManager.Mode == ReplaysMode.Write)
        {
            if (!Network.IsNetworkGame)
            {
                foreach (Die die in DiceList)
                {
                    if (die.IsSelected)
                    {
                        die.RandomizeRotation();
                    }
                }
                RerollPreparedDice();
            }
            else
            {
                if (DebugManager.DebugNetwork)
                {
                    UI.AddTestLogEntry("DiceRoll.SyncSelectedDice");
                }
                Network.SyncSelectedDiceAndReroll();
            }
        }
        else
        {
            CurrentDiceRoll.DeselectDice();

            Phases.CurrentSubPhase.IsReadyForCommands = true;
            Roster.GetPlayer(Phases.CurrentSubPhase.RequiredPlayer).SyncDiceResults();
        }
    }
Exemplo n.º 3
0
    public void RollInDice(Action callBack)
    {
        this.callBack = delegate { TryUnblockButtons(this); callBack(); };

        if (Selection.ActiveShip.Owner.GetType() == typeof(Players.HumanPlayer))
        {
            BlockButtons();
        }

        Die newDie = AddDice();

        if (!Network.IsNetworkGame)
        {
            newDie.RandomizeRotation();
            BeforeRollAdditionalPreparedDice();
        }
        else
        {
            Network.GenerateRandom(new Vector2(0, 360), 3, SetAdditionalDiceInitialRotation, BeforeRollAdditionalPreparedDice);
        }

        /*Combat.Defender.CallDiceAboutToBeRolled();
         * Triggers.ResolveTriggers(TriggerTypes.OnDiceAboutToBeRolled, delegate
         * {
         *  Combat.CurrentDiceRoll.RollAdditionalDice(1);
         *  Combat.CurrentDiceRoll.OrganizeDicePositions();
         *  callBack();
         * });*/
    }
Exemplo n.º 4
0
    static IEnumerator WaitForResults(DiceRoll diceRoll, DelegateDiceroll callBack)
    {
        yield return(new WaitForSeconds(WAIT_FOR_DICE_SECONDS));

        //OrganizeDicePositions(diceRoll);
        diceRoll.CalculateWaitedResults();

        callBack(diceRoll);
    }
        public override void Start()
        {
            IsTemporary  = true;
            finishAction = FinishAction;
            checkResults = CheckResults;

            Prepare();
            Initialize();

            UpdateHelpInfo();
        }
Exemplo n.º 6
0
    public void Roll(DelegateDiceroll callBack)
    {
        this.callBack = callBack;

        foreach (Dice dice in DiceList)
        {
            dice.Roll();
        }

        CalculateResults();
    }
Exemplo n.º 7
0
        public override void Start()
        {
            Game         = GameObject.Find("GameManager").GetComponent <GameManagerScript>();
            IsTemporary  = true;
            finishAction = FinishAction;
            checkResults = CheckResults;

            Prepare();
            Initialize();

            UpdateHelpInfo();
        }
Exemplo n.º 8
0
    public void RerollSelected(DelegateDiceroll callBack)
    {
        this.callBack = callBack;

        foreach (var dice in DiceList)
        {
            if (dice.IsSelected)
            {
                dice.Reroll();
            }
        }

        CalculateResults();
    }
Exemplo n.º 9
0
    public void RollInDice(Action callBack)
    {
        this.callBack = delegate { TryUnblockButtons(this); callBack(); };

        if (Selection.ActiveShip.Owner.GetType() == typeof(Players.HumanPlayer))
        {
            BlockButtons();
        }

        Die newDie = AddDice();

        newDie.RandomizeRotation();
        BeforeRollAdditionalPreparedDice();
    }
Exemplo n.º 10
0
    // ROLL IN

    public void RollInDice(DelegateDiceroll callBack)
    {
        CallBack = callBack;
        Die newDie = AddDice();

        if (!ShouldSkipToSync())
        {
            newDie.RandomizeRotation();
            Selection.ActiveShip.CallDiceAboutToBeRolled(RollAdditionalPreparedDice);
        }
        else
        {
            Roster.GetPlayer(Phases.CurrentSubPhase.RequiredPlayer).SyncDiceResults();
            Phases.CurrentSubPhase.IsReadyForCommands = true;
        }
    }
Exemplo n.º 11
0
        public override void Start()
        {
            base.Start();

            IsTemporary = true;
            if (AfterRoll == null)
            {
                AfterRoll = FinishAction;
            }
            checkResults = CheckResults;

            Prepare();
            Initialize();

            UpdateHelpInfo();
        }
Exemplo n.º 12
0
    public void Roll(DelegateDiceroll callBack)
    {
        DiceRoll.CurrentDiceRoll = this;

        this.callBack = callBack;

        if (!ShouldSkipToSync())
        {
            foreach (Die die in DiceList)
            {
                die.RandomizeRotation();
            }
            RollPreparedDice();
        }
        else
        {
            Roster.GetPlayer(Phases.CurrentSubPhase.RequiredPlayer).SyncDiceResults();
        }
    }
Exemplo n.º 13
0
    public void Roll(DelegateDiceroll callBack)
    {
        DiceRoll.CurrentDiceRoll = this;

        this.callBack = callBack;

        if (!Network.IsNetworkGame)
        {
            foreach (Die die in DiceList)
            {
                die.RandomizeRotation();
            }
            RollPreparedDice();
        }
        else
        {
            if (DebugManager.DebugNetwork)
            {
                UI.AddTestLogEntry("DiceRoll.Roll");
            }
            Network.GenerateRandom(new Vector2(0, 360), DiceList.Count * 3, SetDiceInitialRotation, RollPreparedDice);
        }
    }
Exemplo n.º 14
0
    // REROLL

    public void RerollSelected(DelegateDiceroll callBack)
    {
        DiceRoll.CurrentDiceRoll = this;
        this.CallBack            = callBack;

        if (!ShouldSkipToSync())
        {
            foreach (Die die in DiceList)
            {
                if (die.IsSelected)
                {
                    die.RandomizeRotation();
                }
            }
            RerollPreparedDice();
        }
        else
        {
            CurrentDiceRoll.DeselectAll();
            Roster.GetPlayer(Phases.CurrentSubPhase.RequiredPlayer).SyncDiceResults();
            Phases.CurrentSubPhase.IsReadyForCommands = true;
        }
    }
Exemplo n.º 15
0
    public void RerollSelected(DelegateDiceroll callBack)
    {
        this.callBack = callBack;

        if (!Network.IsNetworkGame)
        {
            foreach (Die die in DiceList)
            {
                if (die.IsSelected)
                {
                    die.RandomizeRotation();
                }
            }
            RerollPreparedDice();
        }
        else
        {
            if (DebugManager.DebugNetwork)
            {
                UI.AddTestLogEntry("DiceRoll.SyncSelectedDice");
            }
            Network.SyncSelectedDiceAndReroll();
        }
    }
Exemplo n.º 16
0
 public void CalculateResults(DelegateDiceroll callBack)
 {
     Dices.PlanWaitForResults(this, callBack);
 }
Exemplo n.º 17
0
 public static void PlanWaitForResults(DiceRoll diceRoll, DelegateDiceroll callBack)
 {
     Game.StartCoroutine(WaitForResults(diceRoll, callBack));
 }
Exemplo n.º 18
0
 public static void RerollDices(DiceRoll diceRoll, string results, DelegateDiceroll callback)
 {
     diceRoll.Reroll(results);
     Game.StartCoroutine(WaitForResults(diceRoll, callback));
 }
Exemplo n.º 19
0
 public static void RerollOne(DiceRoll diceRoll, DelegateDiceroll callback)
 {
     diceRoll.RerollOne();
     Game.StartCoroutine(WaitForResults(diceRoll, callback));
 }