コード例 #1
0
ファイル: InputManager.cs プロジェクト: MrHungerrr/Qmobi_Test
    public InputManager()
    {
        _controls = new PlayerInput();

        #region Game
        _controls.Game.Movement.started   += ctx => ShipMove.Invoke(true);
        _controls.Game.Movement.canceled  += ctx => ShipMove.Invoke(false);
        _controls.Game.Rotation.performed += ctx => ShipRotate.Invoke(ctx.ReadValue <float>());
        _controls.Game.Rotation.canceled  += ctx => ShipRotate.Invoke(0);
        _controls.Game.Fire.started       += ctx => ShipFire.Invoke(true);
        _controls.Game.Fire.canceled      += ctx => ShipFire.Invoke(false);
        _controls.Game.Pause.started      += ctx => GamePause.Invoke();
        _controls.Game.Restart.started    += ctx => GameRestart.Invoke();
        #endregion

        #region Pause
        _controls.Pause.Exit.started   += ctx => PauseExit.Invoke();
        _controls.Pause.Resume.started += ctx => PauseResume.Invoke();
        #endregion

        #region Game Over
        _controls.GameOver.Restart.started += ctx => GameOverRestart.Invoke();
        _controls.GameOver.Exit.started    += ctx => GameOverExit.Invoke();
        #endregion

        GameManager.Instance.OnGameStateChanged += SwitchInputType;
    }
コード例 #2
0
ファイル: ShipController.cs プロジェクト: Pavel4096/Asteroids
        public static ShipController GetShip(Game gameView, ShipModel shipModel)
        {
            IView         shipView         = gameView.CreateView(shipModel.Name);
            IShipMove     shipMove         = new ShipMove(shipView.Rigidbody2D, shipModel.MoveForce);
            IShipRotate   shipRotate       = new ShipRotate(shipView.Rigidbody2D, shipModel.Torque);
            IShipHealth   shipHealth       = new ShipHealth(shipModel.MaxHealth);
            IShipCollided shipCollided     = new ShipCollided(shipView, shipHealth);
            IShipFire     shipFire         = new ShipFire();
            FireLock      fireLock         = new FireLock();
            IShipFire     shipLockableFire = new ShipLockableFire(shipFire, fireLock);

            return(new ShipController(shipModel, shipView, shipMove, shipRotate, shipCollided, shipHealth, shipLockableFire, fireLock));
        }
コード例 #3
0
    /* Methods */

    // Use this for initialization
    void Start()
    {
        //Find and assign associated behaviours
        bank   = gameObject.GetComponentInChildren <ShipBank>();
        roll   = gameObject.GetComponentInChildren <ShipRoll>();
        wings  = gameObject.GetComponentsInChildren <ShipWing>();
        boost  = gameObject.GetComponent <ShipBoost>();
        rotate = gameObject.GetComponent <ShipRotate>();
        move   = gameObject.GetComponent <ShipMove>();


        //
        //
        //Set camera's boundaries based on player's boundaries
        cameraPan.SetPanMaxDistance(5.0f, 5.0f);
        //
        //

        //Assign associated values to ensure animations sync up properly
        wings[0].wingDestroyed = false;
        wings[1].wingDestroyed = false;
    }
コード例 #4
0
 public void OnEnable()
 {
     //Ensure there is a reference to the actual manager
     shipRotate = (ShipRotate)target;
 }