コード例 #1
0
    private void Start()
    {
        EventMessenger.Subscribe(GameEvent.ConnetorSwitchToOn, this, OnConnetorSwitchToOn);

        _UIRoot = GameObject.Find("UI Root");
        if (_UIRoot == null)
        {
            Debug.LogError("UI Root not found");
        }

        if (_needRoomContentGeneration)
        {
            RoomContentGenerator.Generate();
            EventMessenger.SendMessage(GameEvent.CompleteContentGeneration, this);
        }

        if (_needShapesGeneration)
        {
            ShapesGenerator.Generate();
            EventMessenger.SendMessage(GameEvent.CompleteNodesGeneration, this);
        }

        Invoke("StartGameProcess", 0.3f);
        //StartGameProcess();
    }
コード例 #2
0
        public void GetShape_WhenCalled_ReturnsSeedSepcifShape()
        {
            //seed 1 with range: (0,7) will give: 1 0 3 5 4 3 2 6 0 4
            var shapesGenerator = new ShapesGenerator(
                Shapes.GetL(),     //0
                Shapes.GetL2(),    //1
                Shapes.GetZ(),     //2
                Shapes.GetZ2(),    //3
                Shapes.Get2x2(),   //4
                Shapes.Get4line(), //5
                Shapes.GetK());    //6

            shapesGenerator.RandomSeed = 1;

            var res = shapesGenerator.GetShape();

            Assert.That(res, Is.EqualTo(Shapes.GetL2()));

            res = shapesGenerator.GetShape();
            Assert.That(res, Is.EqualTo(Shapes.GetL()));

            res = shapesGenerator.GetShape();
            Assert.That(res, Is.EqualTo(Shapes.GetZ2()));

            res = shapesGenerator.GetShape();
            Assert.That(res, Is.EqualTo(Shapes.Get4line()));
        }
コード例 #3
0
        public void GetShape_WhenCalled_RenturnsOnlyShameShape()
        {
            var shapesGenerator = new ShapesGenerator(Shapes.Get4line());

            var res = shapesGenerator.GetShape();

            Assert.That(res, Is.EqualTo(Shapes.Get4line()));

            res = shapesGenerator.GetShape();
            Assert.That(res, Is.EqualTo(Shapes.Get4line()));

            res = shapesGenerator.GetShape();
            Assert.That(res, Is.EqualTo(Shapes.Get4line()));
        }