예제 #1
0
    private void JumpEvent(object sender, View.PlayerInput e)
    {
        // float JumpSpeed = 2.0f;

        /*
         * if(model.player.character.grounded )
         * {
         *  model.player.character.rigidbody.AddForce(Vector3.forward * JumpSpeed);
         *  model.player.character.grounded = false;
         * }*/


        if (!view.jumpTriggered)
        {
            //model.player.character.rigidbody.AddRelativeForce(0, 0, -10, ForceMode.Acceleration);
            view.jumpTriggered = true;
        }


        if (view.grounded)
        {
            view.grounded = false;
            //view.jumping = false;
            //model.player.character.rigidbody.AddForce(0, 0, 5, ForceMode.Impulse);
            //model.player.character.rigidbody.transform.Translate(Vector3.forward * JumpSpeed);
            model.player.character.rigidbody.AddForce(e.velocity);
            print("Player jumped");
            model.player.character.rigidbody.transform.parent = null;
            view.jumping = false;
        }

        //playerCharacter.gameObject.GetComponent<Rigidbody>().AddForce(0, 50, 0, ForceMode.Impulse);
    }
예제 #2
0
 private void MoveEvent(object sender, View.PlayerInput e)
 {
     //float moveSpeed = 1.0f;
     //Update player position by input
     //print("Player moved");
     //model.player.character.rigidbody.velocity = e.position * 10;
     //model.player.character.position.y = 0;
     model.player.character.rigidbody.velocity = new Vector3(e.velocity.x * 10, 0, e.velocity.z);
     //model.player.character.rigidbody.transform.Translate( new Vector3(e.velocity.x / 4, 0, e.velocity.z));
     //model.player.character.rigidbody.AddForce(e.force);
     //model.player.character.rigidbody.velocity = e.force;
     //model.player.character.rigidbody.transform.Translate(Vector3.right * e.position.x / 10 );
     //model.player.character.rigidbody.useGravity = true;
 }
    private void MoveEvent(object sender, View.PlayerInput e)
    {
        //Update player position by input
		print(e);
        model.player.spaceship.rigidbody.velocity = e.position * 10;
    }