Esempio n. 1
0
        public void StartingBalanceTest()
        {
            int balance;

            balance = CoinControl.getBalance();
            Assert.IsTrue(balance == 0);
        }
        public static async Task WaitForSelectProperty()
        {
            //放大硬币
            CoinControl.ScaleUp();
            await Task.Delay(1000);

            CoinControl.Unfold();
            AgainstInfo.IsWaitForSelectProperty = true;
            AgainstInfo.SelectProperty          = Region.None;
            //暂时设为1秒,之后还原成10秒
            Timer.SetIsTimerStart(1);
            //AgainstInfo.SelectRegion = null;
            await Task.Run(async() =>
            {
                // Debug.Log("等待选择属性");
                while (AgainstInfo.SelectProperty == Region.None)
                {
                    StateInfo.TaskManager.Token.ThrowIfCancellationRequested();
                    if (AgainstInfo.isAIControl)
                    {
                        //Debug.Log("自动选择属性");
                        int rowRank = AiCommand.GetRandom(0, 4);
                        CoinControl.ChangeProperty((Region)rowRank);
                    }
                    await Task.Delay(1000);
                }
            });

            Command.Network.NetCommand.AsyncInfo(NetAcyncType.SelectProperty);
            Timer.SetIsTimerClose();
            AgainstInfo.IsWaitForSelectProperty = false;
            await Task.Delay(1000);

            CoinControl.ScaleDown();
        }
Esempio n. 3
0
 public VendingMachine()
 {
     _totalValue      = 0;
     _display         = INSERTCOIN;
     _selectedProduct = null;
     _coinControl     = new CoinControl();
     _productControl  = new ProductControl();
 }
Esempio n. 4
0
 private void InitCoins(List <Coin> coinsList)
 {
     foreach (Coin c in coinsList)
     {
         CoinControl cc = new CoinControl(_boardControl.Panel);
         cc.Init(c);
         _coinsDic.Add(c.Id, cc);
     }
 }
Esempio n. 5
0
 private void SetCoin(string path)
 {
     foreach (Coin elem in coins)
     {
         CoinControl key = new CoinControl(path);
         canvas.Children.Add(key);
         key.SetValue(Canvas.TopProperty, elem.y * 20.0 + 1);
         key.SetValue(Canvas.LeftProperty, elem.x * 10.0 + 1);
     }
 }
Esempio n. 6
0
        public void RemoveBalanceTest()
        {
            int beforeRemoveBalance;
            int afterRemoveBalance;

            beforeRemoveBalance = CoinControl.getBalance();
            CoinControl.removeCoins(10);
            afterRemoveBalance = CoinControl.getBalance();
            Assert.IsTrue(beforeRemoveBalance == afterRemoveBalance + 10);
        }
Esempio n. 7
0
        public void AddBalanceTest()
        {
            int beforeAddBalance;
            int afterAddBalance;

            beforeAddBalance = CoinControl.getBalance();
            coinControl.addCoins(10);
            afterAddBalance = CoinControl.getBalance();
            Assert.IsTrue(beforeAddBalance == afterAddBalance - 10);
        }
Esempio n. 8
0
        public void RemoveBalanceOverAllowed()
        {
            int beforeRemoveBalance;
            int afterRemoveBalance;

            beforeRemoveBalance = CoinControl.getBalance();
            bool returnvalue = CoinControl.removeCoins(beforeRemoveBalance * 2);

            afterRemoveBalance = CoinControl.getBalance();
            Assert.IsTrue(beforeRemoveBalance == afterRemoveBalance && !returnvalue);
        }
Esempio n. 9
0
    // ================================================================ //

    // 코인 게임 오브젝트를 만든다.
    private CoinControl     create_coin_object(Vector3 position)
    {
        GameObject go = GameObject.Instantiate(this.coin_prefab) as GameObject;

        CoinControl coin = go.GetComponent <CoinControl>();

        coin.score_control = this.score_control;
        coin.map_creator   = this.map_creator;

        coin.transform.position = position;

        return(coin);
    }
Esempio n. 10
0
    void Start()
    {
        //Instantiate Camera & player
        cam    = Instantiate(cam);
        Player = Instantiate(Player);
        Player.AddComponent <PlayerMovement>();
        PlayerInstanceMovementScript = (PlayerMovement)Player.GetComponent(typeof(PlayerMovement));
        PlayerInstanceMovementScript.addCamera(cam);
        coinControlScript = new CoinControl();

        //Instantiate score
        //Score ScoreScript = (Score)Player.GetComponent(typeof(PlayerMovement));
        //ScoreScript.addPlayer(Player);

        //Initate image control
        playerMarketScript = (PlayerMarket)Player.GetComponent(typeof(PlayerMarket));
        playerMarketScript.setPlayer(Player);

        //get darkness script
        darknessOverlayObject = Instantiate(darknessOverlayObject);
        darknessOverlayScript = (DarknessOverlay)darknessOverlayObject.GetComponent(typeof(DarknessOverlay));


        //Instantiate backgounds
        BackgroundImageFirst  = Instantiate(BackgroundImageFirst);
        BackgroundImageSecond = Instantiate(BackgroundImageSecond);

        //add parallax
        Player.AddComponent <Parallax>();
        ParallaxScript = (Parallax)Player.GetComponent(typeof(Parallax));
        ParallaxScript.Construct(BackgroundImageFirst, BackgroundImageSecond, cam);

        //add camera component to movement controls
        PlayerControlsScript = (PlayerControls)Player.GetComponent(typeof(PlayerControls));
        PlayerControlsScript.addCamera(cam);

        //get start positions
        startPosPlayer = Player.transform.position;
        backgroundPos1 = BackgroundImageFirst.transform.position;
        backgroundPos2 = BackgroundImageSecond.transform.position;

        //Start game
        startGame();
    }