Inheritance: MonoBehaviour
Esempio n. 1
0
    public static BallActions CreateWithDefaultBindings()
    {
        var playerActions = new BallActions();

        playerActions.Jump.AddDefaultBinding(Key.Space);
        playerActions.Jump.AddDefaultBinding(InputControlType.Action1);

        playerActions.Brake.AddDefaultBinding(Key.LeftShift);
        playerActions.Brake.AddDefaultBinding(InputControlType.Action2);

        playerActions.Left.AddDefaultBinding(Key.LeftArrow);
        playerActions.Right.AddDefaultBinding(Key.RightArrow);
        playerActions.Up.AddDefaultBinding(Key.UpArrow);
        playerActions.Down.AddDefaultBinding(Key.DownArrow);

        playerActions.Left.AddDefaultBinding(InputControlType.LeftStickLeft);
        playerActions.Right.AddDefaultBinding(InputControlType.LeftStickRight);
        playerActions.Up.AddDefaultBinding(InputControlType.LeftStickUp);
        playerActions.Down.AddDefaultBinding(InputControlType.LeftStickDown);

        playerActions.Left.AddDefaultBinding(InputControlType.DPadLeft);
        playerActions.Right.AddDefaultBinding(InputControlType.DPadRight);
        playerActions.Up.AddDefaultBinding(InputControlType.DPadUp);
        playerActions.Down.AddDefaultBinding(InputControlType.DPadDown);

        playerActions.Shift.AddDefaultBinding(Key.Shift);
        playerActions.Shift.AddDefaultBinding(InputControlType.Action2);

        return(playerActions);
    }
Esempio n. 2
0
    public static BallActions CreateWithDefaultBindings()
    {
        var playerActions = new BallActions();

        playerActions.Jump.AddDefaultBinding( Key.Space );
        playerActions.Jump.AddDefaultBinding( InputControlType.Action1 );

        playerActions.Brake.AddDefaultBinding (Key.LeftShift);
        playerActions.Brake.AddDefaultBinding (InputControlType.Action2);

        playerActions.Left.AddDefaultBinding( Key.LeftArrow );
        playerActions.Right.AddDefaultBinding( Key.RightArrow );
        playerActions.Up.AddDefaultBinding( Key.UpArrow );
        playerActions.Down.AddDefaultBinding( Key.DownArrow );

        playerActions.Left.AddDefaultBinding( InputControlType.LeftStickLeft );
        playerActions.Right.AddDefaultBinding( InputControlType.LeftStickRight );
        playerActions.Up.AddDefaultBinding( InputControlType.LeftStickUp );
        playerActions.Down.AddDefaultBinding( InputControlType.LeftStickDown );

        playerActions.Left.AddDefaultBinding( InputControlType.DPadLeft );
        playerActions.Right.AddDefaultBinding( InputControlType.DPadRight );
        playerActions.Up.AddDefaultBinding( InputControlType.DPadUp );
        playerActions.Down.AddDefaultBinding( InputControlType.DPadDown );

        playerActions.Shift.AddDefaultBinding (Key.Shift);
        playerActions.Shift.AddDefaultBinding (InputControlType.Action2);

        return playerActions;
    }
Esempio n. 3
0
 public Play()
 {
     InitializeComponent();
     action          = MoveBall;
     action         += bounce;
     Bricksdestroyed = 0;
 }
Esempio n. 4
0
        public Form1()
        {
            InitializeComponent();

            BallMovements  = BounceBall;
            BallMovements += MoveBall;
        }
Esempio n. 5
0
        public ControlGameUI()
        {
            InitializeComponent();

            BallMoves  = BounceBall;
            BallMoves += MoveBall;
        }
        public ControlArkanoid()
        {
            InitializeComponent();

            BallMovements  = BounceBall;
            BallMovements += MoveBall;
        }
        /*REAL
         *   int xAxis = 10;
         *   int yAxis = 5;*/
        /*PRUEBA
         * int xAxis = 3;
         * int yAxis = 3;*/

        public ArkanoidControl()
        {
            InitializeComponent();

            //Al delegate se le suscriben dos metodos
            BallMovement  = BounceBall;
            BallMovement += MoveBall;
        }
 public ControlArkanoid(Player jug)
 {
     //Agrega métodos al delegate
     InitializeComponent();
     BallMovement  = BounceBall;
     BallMovement += MoveBall;
     player        = jug;
 }
Esempio n. 9
0
 public Play()
 {
     InitializeComponent();
     Height      = ClientSize.Height;
     Width       = ClientSize.Width;
     WindowState = FormWindowState.Maximized;
     movements   = rebound;
     movements  += movement;
 }
Esempio n. 10
0
 public Play()
 {
     // Se inicializa la variable del componet para los movimientos
     InitializeComponent();
     Height      = ClientSize.Height;//obtener el componente vertical y horizontal de la estructura del tamaño
     Width       = ClientSize.Width;
     WindowState = FormWindowState.Maximized;
     movements   = rebound;
     movements  += movement;
 }
Esempio n. 11
0
 void OnCollisionEnter2D(Collision2D collision)
 {
     if (sticky)
     {
         Vector3 offset = collision.gameObject.transform.position -
                          gc.board.transform.position;
         BallActions ba = collision.gameObject.GetComponent <BallActions>();
         ba.offsetX = offset.x;
         ba.sticked = true;
     }
 }
Esempio n. 12
0
        //Método que lleva a cabo los movimientos de la pelota
        private void TmrGame_Tick(object sender, EventArgs e)
        {
            GameRemainingTime();

            if (!GameData.startGame) //Si el juego no ha iniciado no realiza moviemientos de la pelota
            {
                return;
            }

            BallActions.Invoke();
        }
        public frmDesign(Player registeredPlayer)
        {
            InitializeComponent();
            currentPlayer  = registeredPlayer;
            BallMovements  = rebotarPelota;
            BallMovements += MoveBall;

            Height      = ClientSize.Height;
            Width       = ClientSize.Width;
            WindowState = FormWindowState.Maximized;
        }
Esempio n. 14
0
    // Update is called once per frame
    void Update()
    {
        if (mobile)
        {
            if (Input.touches[0].phase == TouchPhase.Began)
            {
                TouchBegin = Input.touches[0].position;
            }
            if (Input.touches[0].phase == TouchPhase.Moved)
            {
                TouchTimer += Time.deltaTime;
                if (TouchTimer > TouchMinTime)
                {
                    TouchEnd = Input.touches[0].position;
                }
                Vector2 ofst = TouchEnd - TouchBegin;
                if (TouchBegin.x > 0 && TouchEnd.x > 0 &&
                    ofst.x * ofst.x + ofst.y * ofst.y >= TouchMinDist * TouchMinDist)
                {
                    foreach (GameObject ball in balls)
                    {
                        BallActions ba = ball.GetComponent <BallActions>();
                        if (ba.sticked)
                        {
                            ba.MyShoot();
                            break;
                        }
                    }
                }
                TouchTimer = 0;
                TouchBegin = TouchEnd;
            }
        }

        if (Input.GetKey("space"))
        {
            foreach (GameObject ball in balls)
            {
                BallActions ba = ball.GetComponent <BallActions>();
                if (ba.sticked)
                {
                    ba.MyShoot();
                    break;
                }
            }
        }

        if (Application.platform == RuntimePlatform.Android &&
            (Input.GetKeyDown(KeyCode.Escape)))
        {
            Pause();
        }
    }
Esempio n. 15
0
    void OnCollisionExit2D(Collision2D collision)
    {
        BallActions ba = collision.gameObject.GetComponent <BallActions> ();

        if (!ba.sticked && collision.gameObject.tag == "Ball")
        {
            Vector2 v   = ba.rb.velocity;
            float   vv  = (float)System.Math.Sqrt(v.x * v.x + v.y * v.y);
            Vector3 off = collision.gameObject.transform.position - transform.position;
            // print(off.x);
            ba.rb.velocity = new Vector2(vv * (float)System.Math.Sin(off.x), vv * (float)System.Math.Cos(off.x));
        }
    }
        public FrmGame(string player)
        {
            InitializeComponent();
            Pplayer     = player;
            WindowState = FormWindowState.Maximized;
            Height      = Screen.PrimaryScreen.Bounds.Height;
            Width       = Screen.PrimaryScreen.Bounds.Width;

            increment = 10;

            BallMovement  = BounceBall;
            BallMovement += MoveBall;
        }
Esempio n. 17
0
 // Use this for initialization
 void Start()
 {
     body          = GetComponent <Rigidbody2D> ();
     playerActions = BallActions.CreateWithDefaultBindings();
     storedEnergy  = 0;
 }
Esempio n. 18
0
 // Use this for initialization
 void Start()
 {
     body = GetComponent<Rigidbody2D> ();
     playerActions = BallActions.CreateWithDefaultBindings();
     storedEnergy = 0;
 }
 public void SetAction(BallActions action)
 {
     m_CurrentActionType = action;
     m_CurrentAction     = m_Actions[action];
     m_CurrentAction.StartAction();
 }