Exemple #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);
        }
Exemple #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;
        }
    }
Exemple #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);
    }
Exemple #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);
        }
Exemple #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;
    }
Exemple #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"]);
        }
Exemple #7
0
 void Awake()
 {
     playerDatingController = GetComponent <PlayerDatingController>();
     gameLoopController     = FindObjectOfType <GameLoopController>();
     FillDialogueTrees();
 }
Exemple #8
0
 private void Awake()
 {
     instance = this;
 }
Exemple #9
0
 public void StopDigging()
 {
     GameLoopController.StopDigging();
 }
Exemple #10
0
 private void InitializeCameraController()
 {
     _gameLoopController = new GameLoopController(this);
     _cameraController   = new CameraController(Camera, _gameLoopController);
 }
Exemple #11
0
 public void Init()
 {
     m_scannerManager     = InstanceManager.ScannerManager;
     m_guiManager         = InstanceManager.GUIManager;
     m_gameLoopController = InstanceManager.GameLoopController;
 }