Ejemplo n.º 1
0
 public InputHandler(Game g, LazyGameObject <Player> p, InputBridge br)
 {
     MyGame               = g;
     AssociatedPlayer     = p;
     Bridge               = br;
     bottomState.MyGame   = MyGame;
     bottomState.MyBridge = Bridge;
     bottomState.MyPlayer = AssociatedPlayer;
 }
Ejemplo n.º 2
0
 public MainTick()
 {
     goManager     = new Core.GameObjectManager();
     renderManager = new Render.RenderManager(goManager);
     inputBridge   = new Input.InputBridge(renderManager);
     gameManager   = new Game.GameManager();
     uiManager     = new GUI.UIManager();
     renderManager.SetUIManager(uiManager);
     Update();
 }
Ejemplo n.º 3
0
 public void AssociateInputBridge(InputBridge ib, Int32 PlayerID)
 {
     if (InputHandlers.ContainsKey(PlayerID))
     {
         InputHandlers[PlayerID].Bridge = ib;
     }
     else
     {
         InputHandlers.Add(PlayerID, new InputHandler(this, new LazyGameObject <Player>(PlayerID), ib));
     }
 }
Ejemplo n.º 4
0
 public static bool IsKeyPressed(string key)
 {
     try
     {
         return(InputBridge.IsKeyPressed(key));
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 5
0
 public static PointF DragMouseHere(this PointF p, int offsetX = 0, int offsetY = 0)
 {
     if (offsetX == 0 && offsetY == 0)
     {
         return(SetMouseHere(p));
     }
     InputBridge.SendMouse(Models.MouseEventType.LEFT_DOWN);
     Thread.Sleep(5);
     InputBridge.MoveMouse(Models.Point2d.FromPointF(p.Offset(offsetX, offsetY)), true);
     Thread.Sleep(5);
     InputBridge.SendMouse(Models.MouseEventType.LEFT_UP);
     return(p);
 }
Ejemplo n.º 6
0
    void Start()
    {
        ib          = Player.GetComponent <InputBridge>();
        CraftSpawnP = craft.transform.position;
        CraftSpawnR = craft.transform.rotation;
        CubeSpawnR  = cube.transform.rotation;

        //Rotations - default is when controller is facing forward, as per normal holding
        //w is ?, defaults at 1
        //x is
        //y is ?, default is 0. Move controller left=+. Move controller right = -
        //z is roll, defaults at 0
    }
Ejemplo n.º 7
0
 public static PointF Click(this PointF p, bool rightClick = false)
 {
     if (rightClick)
     {
         InputBridge.SendMouse(Models.MouseEventType.RIGHT_DOWN);
         InputBridge.SendMouse(Models.MouseEventType.RIGHT_UP);
     }
     else
     {
         InputBridge.SendMouse(Models.MouseEventType.LEFT_DOWN);
         InputBridge.SendMouse(Models.MouseEventType.LEFT_UP);
     }
     return(p);
 }
Ejemplo n.º 8
0
 void Start()
 {
     _animator  = GetComponent <Animator>();
     _input     = InputBridge.Instance;
     _grabbable = GetComponent <Grabbable>();
 }
Ejemplo n.º 9
0
 public static PointF SetMouseHere(this PointF p, int offsetX = 0, int offsetY = 0)
 {
     InputBridge.SetCursorPosition(Models.Point2d.FromPointF(p.Offset(offsetX, offsetY)));
     return(new PointF(p.X + offsetX, p.Y + offsetY));
 }
Ejemplo n.º 10
0
 void Start()
 {
     ib = Player.GetComponent <InputBridge>();
 }