This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For animation | |
| bool aDucking = false; | |
| if(input.directionalPad.y<0) aDucking = true; | |
| float runSprintTransitionDelay = 1.20f; | |
| float aWalkSpeed=Mathf.Abs(rigidbody2D.velocity.x); | |
| if(isGrounded) { | |
| if(aWalkSpeed>0.1f) { | |
| if(currentAnimation=="CrowRun" && (lastSwitchedAnimation+runSprintTransitionDelay)<Time.time) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BEFORE | |
| else { | |
| if(currentAnimation=="CrowJumpForward" || currentAnimation=="CrowJumpForward_IntoIdle") { | |
| //ChangeAnimation("CrowJumpForward_IntoIdle"); | |
| } | |
| else if(currentAnimation=="CrowSprint" || currentAnimation=="CrowStop") { | |
| //If the player stops pressing all keys while in CrowSprint, play CrowStop. (If in CrowRun, just go back to idle, they dont have enough momentum to slide.) | |
| ChangeAnimation("CrowStop"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BEFORE | |
| else { | |
| if(currentAnimation=="CrowJumpForward" || currentAnimation=="CrowJumpForward_IntoIdle") { | |
| //ChangeAnimation("CrowJumpForward_IntoIdle"); | |
| } | |
| else if(currentAnimation=="CrowSprint" || currentAnimation=="CrowStop") { | |
| //If the player stops pressing all keys while in CrowSprint, play CrowStop. (If in CrowRun, just go back to idle, they dont have enough momentum to slide.) | |
| ChangeAnimation("CrowStop"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| switch (currentAnimation) { | |
| // Runs | |
| case "CrowRun": | |
| if(player.jumping) | |
| ChangeAnimation("CrowJumpForward"); | |
| else if(player.sliding) | |
| ChangeAnimation("CrowStop"); | |
| else if(atMaxSpeed) { | |
| // Player is at max speed, switch to sprint after 1 second |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Runs | |
| CrowRun: | |
| CrowJumpUpward | |
| CrowStop | |
| CrowSprint | |
| CrowIdle | |
| --- | |
| CrowSprint: | |
| CrowJumpForward | |
| CrowStop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| public class PlayerSettings : MonoBehaviour { | |
| // Player settings | |
| public float slideTime = 0.5f; | |
| public float walkSpeed = 2.0f; | |
| public float maxWalkSpeed = 4.0f; | |
| public float initialJumpSpeed = 5.5f; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| public class Checkpoint : MonoBehaviour { | |
| void OnTriggerEnter2D(Collider2D col) | |
| { | |
| Player p = col.GetComponent<Player>(); | |
| if( p != null) { | |
| // Player touched pickup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void SpawnVehicles() { | |
| // Spawn between 3 and 6 vehicles | |
| float carWidth = 10.0f; | |
| for(int i=0;i<Random.Range(3,6);i++) { | |
| Vector3 vPos = playerTransform.position; | |
| vPos += (40.0f*i+40.0f)*Vector3.forward; | |
| //float laneStartX = xStart; | |
| float rx = Random.Range(xStart + carWidth, xStart+levelWidth - carWidth); | |
| GameObject vehicle = (GameObject)Instantiate(vehiclePrefab, vPos, Quaternion.Euler(0,180,0)); | |
| Runner tRunner = vehicle.GetComponent<Runner>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Level 1: | |
| Endless-runner like with open area at end | |
| Level 2: | |
| I drifted deeper in to sleep. | |
| Green background, tree lines. | |
| Level 3: | |
| The dream world grew more abstract and strange. | |
| Floating beds, trees, colorful background. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Command | |
| attr_accessor :name, :response, :needs_arg | |
| def initialize args | |
| needs_arg = false # Default | |
| args.each do |k,v| | |
| instance_variable_set("@#{k}", v) unless v.nil? | |
| end | |
| puts 'Command added: '+name |