Esempio n. 1
0
        public void TestTaxToSupportReturnsNotFoundWithIdMismatch()
        {
            //Get a test controller
            GameContext        context        = GetTestContext("gameloop_tax_to_support_mismatch");
            GameLoopController testController = new GameLoopController(context);

            //Generate the form data
            TaxToSupportInput input = new TaxToSupportInput {
                Id = 4, Cities = 5
            };

            //Run the controller's ResolveTaxToSupport() with a mismatched Id
            IActionResult result = testController.ResolveTaxToSupport(1, input);

            //Assert that we got a not found result
            Assert.IsType <NotFoundResult>(result);
        }
Esempio n. 2
0
    // Movement and physics should happen here
    void FixedUpdate()
    {
        // Ignore input and stuff while not in the digging scene
        if (!GameLoopController.isDiggingScene() || DiggingUIOverlay.IsPopupVisible())
        {
            mRigidbody.velocity     = Vector3.zero;
            mRigidbody.gravityScale = 0f;
            return;
        }

        if (!mInputDisabled)
        {
            HandleMovement();

            mRigidbody.gravityScale = (mWallClimbingLeft || mWallClimbingRight || mGrappleState != GRAPPLE_NONE) ? 0f : 1f;
        }
    }
Esempio n. 3
0
    private void Start()
    {
        new Statistics();
        Statistics.instance.gameOver.AddListener((int i) => StopCoroutine(gameLoop)); //Event for gameOver and stopping coroutine
        //For only temporarily offline testing. Distributing roles goes on before this scene
        distributeRoles();

        if (Current == null)
        {
            Current = this;
        }
        else
        {
            Destroy(gameObject);
        }

        gameLoop = GameLoop();
        StartCoroutine(gameLoop);
    }
Esempio n. 4
0
        public void TestTaxToSupportReturnsToFormOnInvalidModel()
        {
            //Get a test controller
            GameContext        context        = GetTestContext("gameloop_tax_to_support_invalid");
            GameLoopController testController = new GameLoopController(context);

            //Add an error to force the Post: Create() method to return to the form
            testController.ModelState.AddModelError("test error", "automated unit test error");

            //Generate the form data
            TaxToSupportInput input = new TaxToSupportInput {
                Id = 1, Cities = 5
            };

            //Run the controller's ResolveTaxToSupport() with an invalid model
            IActionResult result = testController.ResolveTaxToSupport(1, input);

            //Assert that...
            //...we got a view back
            ViewResult viewResult = Assert.IsType <ViewResult>(result);
        }
Esempio n. 5
0
    // Input and animation can happen here
    private void Update()
    {
        mIsTryingToDig = false;
        mIsDigging     = false;
        mUsingStamina  = false;
        var emission = digEffect.emission;

        // Ignore input and stuff while not in the digging scene, or if there's a popup
        if (!GameLoopController.isDiggingScene() || DiggingUIOverlay.IsPopupVisible() || mInputDisabled)
        {
            AnimatePausedPlayer();
            emission.enabled = false;
            return;
        }
        HandleMouseInput();
        UpdateAnimationState();

        // reveal nearby tiles
        RevealFogTiles();

        emission.enabled = mIsDigging;
    }
Esempio n. 6
0
        public void CanResolveTaxToSupport()
        {
            //Get a test controller
            GameContext        context        = GetTestContext("gameloop_tax_to_support");
            GameLoopController testController = new GameLoopController(context);

            //Generate the form data
            TaxToSupportInput input = new TaxToSupportInput {
                Id = 1, Cities = 5
            };

            //Run the controller's Details() without an Id
            IActionResult result = testController.ResolveTaxToSupport(1, input);

            //Assert that...
            //...we got a redirect back
            RedirectToActionResult redirect = Assert.IsType <RedirectToActionResult>(result);

            //...the action is the index
            Assert.Equal(nameof(GameLoopController.Index), redirect.ActionName);
            //...the route data is the ID of the active civ
            Assert.Equal(input.Id, redirect.RouteValues["id"]);
        }
Esempio n. 7
0
 void Awake()
 {
     playerDatingController = GetComponent <PlayerDatingController>();
     gameLoopController     = FindObjectOfType <GameLoopController>();
     FillDialogueTrees();
 }
Esempio n. 8
0
 private void Awake()
 {
     instance = this;
 }
Esempio n. 9
0
 public void StopDigging()
 {
     GameLoopController.StopDigging();
 }
Esempio n. 10
0
 private void InitializeCameraController()
 {
     _gameLoopController = new GameLoopController(this);
     _cameraController   = new CameraController(Camera, _gameLoopController);
 }
Esempio n. 11
0
 public void Init()
 {
     m_scannerManager     = InstanceManager.ScannerManager;
     m_guiManager         = InstanceManager.GUIManager;
     m_gameLoopController = InstanceManager.GameLoopController;
 }