Skip to content

Commit

Permalink
moved into Prime31 namespace!!!!!
Browse files Browse the repository at this point in the history
reset demo scene RigidBody settings
  • Loading branch information
prime31 committed Jun 14, 2015
1 parent 98ad200 commit de6fd91
Show file tree
Hide file tree
Showing 48 changed files with 59,669 additions and 427 deletions.
837 changes: 417 additions & 420 deletions Assets/CharacterController2D/CharacterController2D.cs

Large diffs are not rendered by default.

Binary file modified Assets/demo/DemoScene.unity
Binary file not shown.
154 changes: 154 additions & 0 deletions Assets/demo/animations/spelunky_animations.png.meta

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions Assets/demo/scripts/DemoScene.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using UnityEngine;
using System.Collections;
using Prime31;


public class DemoScene : MonoBehaviour
Expand All @@ -20,8 +21,6 @@ public class DemoScene : MonoBehaviour
private Vector3 _velocity;




void Awake()
{
_animator = GetComponent<Animator>();
Expand Down Expand Up @@ -64,9 +63,6 @@ void onTriggerExitEvent( Collider2D col )
// the Update loop contains a very simple example of moving the character around and controlling the animation
void Update()
{
// grab our current _velocity to use as a base for all calculations
_velocity = _controller.velocity;

if( _controller.isGrounded )
_velocity.y = 0;

Expand Down Expand Up @@ -105,14 +101,17 @@ void Update()
}


// apply horizontal speed smoothing it
// apply horizontal speed smoothing it. dont really do this with Lerp. Use SmoothDamp or something that provides more control
var smoothedMovementFactor = _controller.isGrounded ? groundDamping : inAirDamping; // how fast do we change direction?
_velocity.x = Mathf.Lerp( _velocity.x, normalizedHorizontalSpeed * runSpeed, Time.deltaTime * smoothedMovementFactor );

// apply gravity before moving
_velocity.y += gravity * Time.deltaTime;

_controller.move( _velocity * Time.deltaTime );

// grab our current _velocity to use as a base for all calculations
_velocity = _controller.velocity;
}

}
2 changes: 1 addition & 1 deletion Assets/demo/scripts/SmoothFollow.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UnityEngine;
using System.Collections;

using Prime31;


public class SmoothFollow : MonoBehaviour
Expand Down
Loading

0 comments on commit de6fd91

Please sign in to comment.