protected virtual void OnMouseWheel(MouseInputState state)
        {
            if (!SimulateMouseWheel.Value)
            {
                return;
            }

            Browser.SimulateMouseWheel(state.mouseX, state.mouseY, state.wheelDeltaX, state.wheelDeltaY);
        }
        protected virtual void OnMouseMove(MouseInputState state)
        {
            if (!SimulateMouseMove.Value)
            {
                return;
            }

            Browser.SimulateMouseMove(state.mouseX, state.mouseY);
        }
        protected virtual void OnMouseUp(MouseInputState state)
        {
            if (!SimulateMouseUp.Value)
            {
                return;
            }

            if (state.PressedButton.HasFlag(MouseInputState.MouseButtonType.LEFT))
            {
                Browser.SimulateMouseUp(state.mouseX, state.mouseY, false);
            }
            else if (state.PressedButton.HasFlag(MouseInputState.MouseButtonType.RIGHT))
            {
                Browser.SimulateMouseUp(state.mouseX, state.mouseY, true);
            }
        }
예제 #4
0
    public void SetMouseInputState(MouseInputState newState)
    {
        mouseInputState = newState;
        switch (mouseInputState)
        {
        case MouseInputState.Idle:
            CallAction(OnInputIdle);
            break;

        case MouseInputState.PlaceTower:
            CallAction(OnInputPlaceTower);
            break;

        case MouseInputState.DragResource:
            CallAction(OnInputDragResource);
            break;
        }
    }
예제 #5
0
    //Initializes the game for each level.
    void InitGame()
    {
        //SceneManager.LoadScene("menu");
        vertExtent = Camera.main.orthographicSize;
        horzExtent = vertExtent * Screen.width / Screen.height;

        // set player status variables
        playerStatus.maxHp                  = 100f;
        playerStatus.currentHp              = 100f;
        playerStatus.maxChargeBarValue      = 1000f;
        playerStatus.currentChargeBarValue  = 0f;
        playerStatus.chargeCoolDownDuration = 3f;
        playerStatus.chargeBarIncreaseRate  = 5f;
        playerStatus.chargeBarDecreaseRate  = 10f;
        playerStatus.shootCoolDownDuration  = 0.2f;
        playerStatus.invincibleDuration     = 2f;
        playerStatus.currentAttackType      = PlayerAttackType.Shoot;

        // set weapon status variables
        weaponStatus.bulletDamage       = 10f;
        weaponStatus.bulletSpeed        = 15f;
        weaponStatus.swordDamage        = 10f;
        weaponStatus.swordRepelForce    = 10f;
        weaponStatus.chargeBulletDamage = 50f;
        weaponStatus.chargeBulletSpeed  = 10f;
        weaponStatus.chargeSwordDamage  = 100f;
        weaponStatus.chargeSwordSpeed   = 3f;

        mouseInputStatus = MouseInputState.Attack;

        gameState = GameState.Tutorial;

        playerLevelManager = new PlayerLevelManager();
        playerLevelManager.SetVitalityToLevel(1);
        playerLevelManager.SetSkillToLevel(1);
        playerLevelManager.SetStrengthToLevel(1);

        coin = 1000;
        wave = 1;

        SetCoinText(coin);
        SetWaveText(wave);
        SetPlayerLevelText(playerLevelManager.playerLevel);
    }
예제 #6
0
 // Use this for initialization
 void Start()
 {
     gameOver        = false;
     mouseInputState = MouseInputState.Idle;
 }