Esempio n. 1
0
    protected void Dice_OnRolled(DiceController InDice, int InDots)
    {
        // Checking if all dices finished rolling
        bool bFinished = true;

        foreach (DiceController dice in Dices)
        {
            if (!dice.HasFinishedRolling())
            {
                bFinished = false;
                break;
            }
        }

        if (bFinished)
        {
            // We're trying to move as many pawns of current player from Band as possible.
            if (MovePawnFromBand())
            {
                // Means that there are some pawns left on the Band or player used all his dices.
                // In any of these 2 scenarios, we're skipping current player's turn.

                SkipTurn();
            }
            else
            {
                SwitchGameState();
            }
        }
    }
Esempio n. 2
0
    private void Initialize()
    {
        TutorialDialogueController.dialogueTurn = 0;
        TutorialDialogueController.isClickable  = true;

        blockController     = FindObjectOfType <BlockController>();
        diceController      = FindObjectOfType <DiceController>();
        resetDiceController = FindObjectOfType <ResetDiceController>();

        // tutorialGuideCanvas = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.TUTORIAL_GUIDE_CANVAS);
        attackGage = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.ATTACK_GAGE);
        blocks     = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.BLOCKS);
        guideItem  = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.GUIDE_ITEM);
        turn       = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.TURN);
        toast      = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.TOAST);

        oval            = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.OVAL);
        outline         = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.OUTLINE);
        outlineDice     = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.OUTLINE_DICE);
        outlineCircle   = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.OUTLINE_CIRCLE);
        outlineRect     = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.OUTLINE_RECT);
        outlineFullRect = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.OUTLINE_FULL_RECT);
        indicateArrow   = GameObject.Find(Constants.TUTORIAL.GAME_OBJECT_NAME.INDICATE_ARROW);

        ToggleClickEventResetDiceScreen(false);
    }
Esempio n. 3
0
    // Start is called before the first frame update
    void Start()
    {
        mDiceCountroller = Dice.GetComponent <DiceController>();

        // ターン開始
        StartCoroutine(SeaquenceOneTarn_());
    }
Esempio n. 4
0
        public void ClearPlayerHistoryEmptiesPlayerRolls()
        {
            //Arrange
            GameVariables.Round = 1;
            testMain.crapsDataSet.Clear();
            testMain.tableAdapterManager.UpdateAll(testMain.crapsDataSet);
            PlayerController.AddAndActivatePlayer("RollTest", testMain);
            GameController.NewGame(testMain);
            DiceController.PopulateRolls(new int[2] {
                1, 1
            }, testMain);
            DiceController.PopulateRolls(new int[2] {
                1, 1
            }, testMain);
            DiceController.PopulateRolls(new int[2] {
                1, 1
            }, testMain);

            //Act
            PlayerController.ClearPlayerHistory(testMain);

            //Assert
            int afterClearRolls = testMain.crapsDataSet.Roll.Rows.Count;

            Assert.AreEqual(0, afterClearRolls);
        }
Esempio n. 5
0
        public void ClearPlayerHistoryEmptiesPlayerGames()
        {
            //Arrange
            GameVariables.Round = 1;
            testMain.crapsDataSet.Clear();
            testMain.tableAdapterManager.UpdateAll(testMain.crapsDataSet);
            PlayerController.AddAndActivatePlayer("RollTest", testMain);
            GameController.NewGame(testMain);
            DiceController.PopulateRolls(new int[2] {
                1, 1
            }, testMain);
            DiceController.PopulateRolls(new int[2] {
                1, 1
            }, testMain);
            DiceController.PopulateRolls(new int[2] {
                1, 1
            }, testMain);

            //Act
            PlayerController.ClearPlayerHistory(testMain);

            //Assert
            int afterClearGames = testMain.crapsDataSet.Game.Rows.Count;

            Assert.AreEqual(1, afterClearGames); //this should equal 1 because Clearing History starts a new game automatically
        }
        public void DiceRollShouldBeBetween1And13()
        {
            DiceController testDiceController = new DiceController();
            int            roll = testDiceController.DiceRoll(1, 12);

            Assert.IsTrue(roll <= 13 && roll >= 1, "The outcome of the 4 sided dice is between 1 and 13. ");
        }
        public void DiceRollShouldBe0IfInputIsNegative()
        {
            DiceController testDiceController = new DiceController();
            int            roll = testDiceController.DiceRoll(1, -10);

            Assert.IsTrue(roll == 0, "The outcome of the 20 should be 0. ");
        }
Esempio n. 8
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Esempio n. 9
0
 // Use this for initialization
 void Start()
 {
     TC = GameObject.Find("GameManager").GetComponent <TileController> ();
     DC = GameObject.Find("GameManager").GetComponent <DiceController> ();
     QG = GameObject.Find("GameManager").GetComponent <QuizGenerator> ();
     RollButton.onClick.AddListener(moveToNext);
 }
Esempio n. 10
0
    protected void Dice_OnUsed(DiceController InDice, DiceState InState)
    {
        // We're checking if player used all his dices already (or he has no other
        // moves available) if so, we're skipping his turn.
        // However, we want to do that only, if the player is actually supposed to move his pawn.
        // If that's not the case and the dice was used, it means that GameManager automatically
        // moved player's pawn from Band to the board. In such scenario, we'll skip player's turn
        // in Dice_OnRolled() after using MovePawnFromBand().

        if (State == GameState.RedPlayerMoves || State == GameState.WhitePlayerMoves)
        {
            bool bEveryFullyUsed = true;
            foreach (DiceController dice in Dices)
            {
                if (dice.GetUsageState() != DiceState.FullyUsed)
                {
                    bEveryFullyUsed = false;
                    break;
                }
            }

            // TODO: checking if there are any available moves
            bool bAvailableMovesExist = true;

            if (bEveryFullyUsed || !bAvailableMovesExist)
            {
                SwitchGameState();
            }
        }
    }
Esempio n. 11
0
    // Use this for initialization
    void Awake()
    {
        score = 0;

        //配列の初期化
        for (int i = 0; i < board.GetLength(0); i++)
        {
            for (int j = 0; j < board.GetLength(1); j++)
            {
                board[i, j]     = -1;
                board_num[i, j] = -1;
            }
        }

        //初期用配列設定
        board[0, 0]     = maxDiceId;
        board_num[0, 0] = 1;

        DiceBase = (GameObject)Resources.Load("Dice");
        Dice     = GameObject.Find("Dice");
        dices.Add(Dice);  //リストにオブジェクトを追加
        Aqui = GameObject.Find("Aqui");
        objAquiController = Aqui.GetComponent <AquiController>();
        objDiceController = Dice.GetComponent <DiceController>();

        if (gameType == 3)
        {
            board[0, 0]     = -1;
            board_num[0, 0] = -1;
            maxDiceId       = 0;
            dices.Clear();
            Destroy(Dice);
        }

        StatusText    = GameObject.Find("StatusText");
        objStatusText = StatusText.GetComponent <StatusTextController>();
        ScreenText    = GameObject.Find("ScreenText");
        objScreenText = ScreenText.GetComponent <ScreenTextController>();

        gobjOGController = GameObject.Find("OnlineGameController");



        //BGM
        if (gameType != 2)
        {
            BgmManager.Instance.Play((stage + 1).ToString()); //BGM
        }
        else
        {
            BgmManager.Instance.Play("tutorial"); //BGM
        }

        //AudioSourceコンポーネントを取得し、変数に格納
        AudioSource[] audioSources = GetComponents <AudioSource>();
        sound_one     = audioSources[0];
        sound_levelup = audioSources[1];
        sound_vanish  = audioSources[2];
    }
Esempio n. 12
0
 void Awake()
 {
     //DeletePlayerPrefs();
     SetDefaultPlayerPrefs();
     diceController = GetComponent <DiceController>();
     uIController   = GameObject.FindGameObjectWithTag("UIController").GetComponent <UIController>();
     Application.targetFrameRate = 60;
 }
Esempio n. 13
0
 /// <summary>
 /// GetHandles haalt alle scripts op die gerefereerd worden in dit script.
 /// </summary>
 void GetHandles()
 {
     uIController     = GameObject.FindWithTag("GameManager").GetComponent <UIController>();
     diceController   = GameObject.FindWithTag("GameManager").GetComponent <DiceController>();
     waypointManager  = GameObject.FindWithTag("GameManager").GetComponent <WaypointManager>();
     cameraSwitcher   = GameObject.FindWithTag("CameraController").GetComponent <CameraSwitcher>();
     diceColorChanger = GameObject.FindWithTag("GameManager").GetComponent <DiceColorChanger>();
 }
Esempio n. 14
0
 private void Start()
 {
     diceController = GameObject.FindGameObjectWithTag("GameController").GetComponent <DiceController>();
     rollBtn.onClick.AddListener(delegate {
         diceController.ScreenTapped();
         statusTxt.gameObject.SetActive(false);
     });
 }
Esempio n. 15
0
 private void Initialize()
 {
     levelLoader           = FindObjectOfType <LevelLoader>();
     newTutorialController = FindObjectOfType <NewTutorialController>();
     blockController       = FindObjectOfType <BlockController>();
     diceController        = FindObjectOfType <DiceController>();
     diceText = this.transform.Find(Constants.GAME_OBJECT_NAME.NUMBER_TEXT).GetComponent <Text>();
 }
Esempio n. 16
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        InitializeDices();
    }
Esempio n. 17
0
 void Awake()
 {
     if (instance == null)
     {
         instance       = this;
         spriteRenderer = GetComponentInChildren <SpriteRenderer>();
         poneiScript    = GameObject.Find("Ponei").GetComponent <Ponei>();
         dino           = GameObject.Find("Dinossour").GetComponent <Dinossaur>();
     }
 }
Esempio n. 18
0
 void Start()
 {
     diceController                = GameObject.FindGameObjectWithTag("diceController");
     diceControllerScript          = diceController.GetComponent <DiceController>();
     diceScript                    = dicePrefab.GetComponent <Dice>();
     diceScript.diceMaterial.color = diceScript.royal;
     floorScript                   = Plane.GetComponent <Floor>();
     DiceColorDropdown.onValueChanged.AddListener(delegate { onValueChangeOfDiceColorDropdown(DiceColorDropdown); });
     PlaneColorDropdown.onValueChanged.AddListener(delegate { onValueChangeOfPlaneColorDropdown(PlaneColorDropdown); });
     BrightnessSlider.onValueChanged.AddListener(delegate { adjustBrightness(); });
 }
Esempio n. 19
0
    void FixedUpdate()
    {
        Vector3 gravity = new Vector3(-Input.acceleration.y, Input.acceleration.z, Input.acceleration.x);

        Physics.gravity = (gravityFactor * 9.8f) * gravity.normalized;
        if (Input.gyro.userAcceleration.magnitude >= forceThreshold)
        {
            Vector3 userAcc = new Vector3(-Input.gyro.userAcceleration.y, Input.gyro.userAcceleration.z, Input.gyro.userAcceleration.x);
            DiceController.AddForceToDices(forceFactor * userAcc);
        }
    }
Esempio n. 20
0
    // Use this for initialization
    void Start()
    {
        ButtonMaju.SetActive(true);
        TC   = GameObject.Find("GameManager").GetComponent <TileController> ();
        DC   = GameObject.Find("GameManager").GetComponent <DiceController> ();
        QG   = GameObject.Find("GameManager").GetComponent <QuizGenerator> ();
        AC   = GameObject.Find("AudioManager").GetComponent <SoundController> ();
        Tele = GameObject.Find("GameManager").GetComponent <TeleportController> ();
        RollButton.onClick.AddListener(getDiceRoll);

        theDice = GameObject.Find("Dice").GetComponent <Animator> ();
    }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            // Create new instance of teerling
            DiceController dice = new DiceController();

            // Add teerling view to current form
            this.Controls.Add(dice.view);

            this.components    = new System.ComponentModel.Container();
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Text          = "Form1";
        }
Esempio n. 22
0
    /// <summary>
    /// 初始化骰子
    /// </summary>
    private async void InitialDice()
    {
        string     dicePath = "Dice";
        GameObject Obj      = await ABManager.GetAssetAsync <GameObject>(dicePath);

        Transform  tra     = ZillionairePlayerManager._instance.CurrentPlayer.transform.parent;
        GameObject diceObj = Instantiate(Obj, tra);

        _diceController = diceObj.GetComponent <DiceController>();
        _diceController.NotifyPlayDiceAnim(6, null);
        _diceController.InitIsThrow();
        //diceObj.SetActive(false);
    }
Esempio n. 23
0
 void HandleTouch()
 {
     if (Input.touchCount > 0)
     {
         Touch touch = Input.GetTouch(0);
         if (touch.phase == TouchPhase.Began)
         {
             Vector3 spawnPoint = mainCamera.ScreenToWorldPoint(new Vector3(touch.position.x, touch.position.y, cameraToCeiling - spawnOffset)) - worldOffset;
             spawnPoint.y = wallHeight - spawnOffset;
             DiceController.SpawnDices("1d6", "d6-" + randomColor + "-dots", spawnPoint, mainWrapper);
         }
     }
 }
Esempio n. 24
0
    // Use this for initialization
    void Awake()
    {
        diceController = GameObject.FindGameObjectWithTag("Dice").GetComponent <DiceController>();
        if (diceController == null)
        {
            Debug.Log("Error Get DiceController");
        }
        else
        {
            Debug.Log("DiceController Loaded!!");
        }

        global = FindObjectOfType <Globals>();
    }
Esempio n. 25
0
 public void Roll(bool updateSprite = true)
 {
     if (Value != -1)
     {
         return;
     }
     Value = DiceController.RollD6();
     if (updateSprite)
     {
         SetImageByValue();
     }
     OnDiceRoll?.Invoke(this);
     MusicManager.Instance.PlaySound(2);
 }
Esempio n. 26
0
        public async Task TryToOverflowDice()
        {
            Fabric.CreateFactoryImpl = CreateFactory;

            var input = new[]
            {
                new KeyValuePair <string, string>("user_name", "user"),
                new KeyValuePair <string, string>("text", "/dice 100000d1000000"),
            };
            var commandInput = new FormDataCollection(input);

            var diceController = new DiceController();
            var message        = await diceController.PostDice(commandInput);

            Assert.AreEqual("Кубик укатился...", message.Text);
        }
Esempio n. 27
0
 public void RollWithAnim(bool setRandValue = true)
 {
     //if (Value == -1)
     //{
     if (_animator == null)
     {
         _animator = GetComponent <Animator>();
     }
     if (setRandValue)
     {
         Value = DiceController.RollD6();
     }
     SetRollAnimation();
     OnDiceRoll?.Invoke(this);
     //}
 }
Esempio n. 28
0
        /// <summary>
        /// Sends packets to clients
        /// </summary>
        /// <param name="start"></param>
        /// <param name="sendDice"></param>
        /// <param name="sendCards"></param>
        public static void SendMonsterPackets(bool start = false, bool sendDice = false, bool sendCards = false)
        {
            var outMsg = _server.CreateMessage();

            if (start)
            {
                outMsg.Write((byte)PacketTypes.Start);
            }
            else
            {
                outMsg.Write((byte)PacketTypes.Update);
            }
            var packets = MonsterController.GetDataPackets();

            outMsg.Write(packets.Length);
            foreach (var packet in packets)
            {
                var json = JsonConvert.SerializeObject(packet);
                outMsg.Write(json);
            }

            if (sendDice)
            {
                outMsg.Write((byte)PacketTypes.Dice);
                var dice = DiceController.GetDataPacket();
                outMsg.Write(JsonConvert.SerializeObject(dice));
            }
            else if (!start)
            {
                outMsg.Write((byte)PacketTypes.NoDice);
            }

            if (sendCards)
            {
                outMsg.Write((byte)PacketTypes.Cards);
                var cards = CardController.GetCardsForSale().Select(CardController.CreateDataPacket).ToArray();
                outMsg.Write(JsonConvert.SerializeObject(cards));
            }
            else if (!start)
            {
                outMsg.Write((byte)PacketTypes.NoCards);
            }

            _server.SendToAll(outMsg, NetDeliveryMethod.ReliableOrdered);
        }
Esempio n. 29
0
 void Start()
 {
     bc            = GameObject.Find("GameBoard").GetComponent <BoardController>();
     dc            = GameObject.Find("DiceContainer").GetComponent <DiceController>();
     active        = false;
     moving        = false;
     started       = false;
     rolled        = false;
     cornerRots    = new Quaternion[4];
     cornerRots[0] = Quaternion.Euler(0f, 0f, 0f);
     cornerRots[1] = Quaternion.Euler(0f, 90f, 0f);
     cornerRots[2] = Quaternion.Euler(0f, 180f, 0f);
     cornerRots[3] = Quaternion.Euler(0f, 270f, 0f);
     boardIndex    = 0;
     tempIndex     = boardIndex;
     boardLocation = bc.getField(boardIndex);
     waypoint      = boardLocation.transform.position;
     waypoint.y    = this.transform.position.y;
     forceMove     = false;
 }
Esempio n. 30
0
        /// <summary>
        /// Function for when player is first starting their turn
        /// </summary>
        private void StartingTurn()
        {
            if (_rollButton.Hidden)
            {
                _rollButton.Hidden = false;
            }
            _diceRow.Hidden = true;
            _diceRow.Clear();

            //RollingDice.Hidden = true;
            // RollingDice.Clear();

            _textPrompts.Clear();
            if (_firstPlay)
            {
                Engine.PlaySound("StartTurn");
                _firstPlay = false;
                Client.SendMessage(_localMonster.Name + " is starting their turn!");
            }
            var cardsOwned = "";

            if (MonsterController.Cards(_localPlayer).Count > 0)
            {
                cardsOwned = MonsterController.Cards(_localPlayer)[0].Name;                                                  //TODO only displays first cards owned, need to show all if this works
            }
            _textPrompts.Add(new TextBlock("RollPrompt", new List <string> {
                "Your Turn! Rolls Left: " + MonsterController.GetById(_localPlayer).RemainingRolls,
                "Cards: " + cardsOwned
            }));

            if (_rollButton.MouseOver(Engine.InputManager.FreshMouseState) && Engine.InputManager.LeftClick())
            {
                _gameState = GameState.Rolling;
                Client.SendActionPacket(GameStateController.Roll());
                System.Threading.Thread.Sleep(200);
                _diceRow.AddDice(DiceController.GetDice());
                _diceRow.Hidden = false;
                //RollingDice.AddDice(DiceController.GetDice());
                //RollingDice.Hidden = false;
            }
        }
    public void RollComplete(DiceController die, TextMesh label, TextMesh labelShort, int position)
    {
        Element e = die.GetElement();

        labelShort.text = e.GetName();

        label.text = e.GetName() + "\nDmg:\n" + e.GetDamage(position).ToString(formatString)
                + "\nAcc:\n" + e.GetAccuracy(position).ToString(formatString)
                + "\nSpeed:\n" + e.GetSpeed(position).ToString(formatString)
                + "\nDie Summary:\n(" + die.GetDieName() + ")";

        dmg += e.GetDamage(position);
        acc += e.GetAccuracy(position);
        speed += e.GetSpeed(position);
        complete++;

        if(complete==3)
        {
            opponentAttack.SetOpponentSpeed(speed);
            if(opponentSpeed!=null) DoAttack();
        }
    }
    private void SetupDicesViews()
    {
        // TODO: refactor this
        DiceView dice1View = Dice1View;
        m_dice1Controller = dice1View.GetComponent<DiceController>();
        m_dice1Controller.Initialize();
        dice1View.Initialize(m_dice1Controller);

        DiceView dice2View = Dice2View;
        m_dice2Controller = dice2View.GetComponent<DiceController>();
        m_dice2Controller.Initialize();
        dice2View.Initialize(m_dice2Controller);

        ThrowDicesView throwDicesView = GameObject.FindObjectOfType<ThrowDicesView>().GetComponent<ThrowDicesView>();
        throwDicesView.Initialize(this);
    }
 private void StartSpin(DiceController die, TextMesh label, TextMesh labelShort, int position)
 {
     label.text = "---";
     labelShort.text = "";
     die.StartSpin( ()=>RollComplete(die, label, labelShort, position) );
 }
Esempio n. 34
0
 /// <summary>
 /// Initializes the view
 /// </summary>
 /// <param name="_diceController">The controller.</param>
 public override void Initialize(BaseController _diceController)
 {
     m_diceController = (DiceController)_diceController;
     m_diceController.SetFaceFotRepresenters(FaceDotRepresenters);
     base.Initialize(_diceController);
 }