Permalink
Browse files

archived

  • Loading branch information...
GandhiGames committed May 18, 2016
0 parents commit 03ec652f35004d54e6bcf2576a8e8876ffd662ca
Showing with 4,604 additions and 0 deletions.
  1. +5 −0 Assets/Audio.meta
  2. BIN Assets/Audio/rewind.mp3
  3. +12 −0 Assets/Audio/rewind.mp3.meta
  4. BIN Assets/Read Me.docx
  5. +4 −0 Assets/Read Me.docx.meta
  6. +5 −0 Assets/Resources.meta
  7. BIN Assets/Resources/laser_blue_horizontal.prefab
  8. +4 −0 Assets/Resources/laser_blue_horizontal.prefab.meta
  9. BIN Assets/Resources/laser_blue_vertical.prefab
  10. +4 −0 Assets/Resources/laser_blue_vertical.prefab.meta
  11. BIN Assets/Resources/player.prefab
  12. +4 −0 Assets/Resources/player.prefab.meta
  13. +5 −0 Assets/Scenes.meta
  14. BIN Assets/Scenes/Demo Scene.unity
  15. +4 −0 Assets/Scenes/Demo Scene.unity.meta
  16. +5 −0 Assets/Scripts.meta
  17. +5 −0 Assets/Scripts/Enemies.meta
  18. +93 −0 Assets/Scripts/Enemies/Bat.cs
  19. +8 −0 Assets/Scripts/Enemies/Bat.cs.meta
  20. +16 −0 Assets/Scripts/Enemies/KillPlayerOnTriggerEnter.cs
  21. +8 −0 Assets/Scripts/Enemies/KillPlayerOnTriggerEnter.cs.meta
  22. +48 −0 Assets/Scripts/Enemies/Laser.cs
  23. +8 −0 Assets/Scripts/Enemies/Laser.cs.meta
  24. +65 −0 Assets/Scripts/Enemies/LaserTurret.cs
  25. +8 −0 Assets/Scripts/Enemies/LaserTurret.cs.meta
  26. +98 −0 Assets/Scripts/Enemies/Slime.cs
  27. +8 −0 Assets/Scripts/Enemies/Slime.cs.meta
  28. +5 −0 Assets/Scripts/Helper.meta
  29. +19 −0 Assets/Scripts/Helper/DestroyAfterTime.cs
  30. +8 −0 Assets/Scripts/Helper/DestroyAfterTime.cs.meta
  31. +36 −0 Assets/Scripts/Helper/Flash.cs
  32. +8 −0 Assets/Scripts/Helper/Flash.cs.meta
  33. +24 −0 Assets/Scripts/Helper/FollowPlayer.cs
  34. +8 −0 Assets/Scripts/Helper/FollowPlayer.cs.meta
  35. +7 −0 Assets/Scripts/IClimbable.cs
  36. +8 −0 Assets/Scripts/IClimbable.cs.meta
  37. +7 −0 Assets/Scripts/IFlippable.cs
  38. +8 −0 Assets/Scripts/IFlippable.cs.meta
  39. +12 −0 Assets/Scripts/IKillable.cs
  40. +8 −0 Assets/Scripts/IKillable.cs.meta
  41. +15 −0 Assets/Scripts/LevelGenerator.cs
  42. +8 −0 Assets/Scripts/LevelGenerator.cs.meta
  43. +5 −0 Assets/Scripts/Player.meta
  44. +139 −0 Assets/Scripts/Player/Physics.cs
  45. +8 −0 Assets/Scripts/Player/Physics.cs.meta
  46. +250 −0 Assets/Scripts/Player/Player.cs
  47. +8 −0 Assets/Scripts/Player/Player.cs.meta
  48. +87 −0 Assets/Scripts/Player/PlayerAnimation.cs
  49. +8 −0 Assets/Scripts/Player/PlayerAnimation.cs.meta
  50. +59 −0 Assets/Scripts/Player/PlayerPhysics.cs
  51. +8 −0 Assets/Scripts/Player/PlayerPhysics.cs.meta
  52. +5 −0 Assets/Scripts/Rewind.meta
  53. +92 −0 Assets/Scripts/Rewind/CharacterRewindHandler.cs
  54. +8 −0 Assets/Scripts/Rewind/CharacterRewindHandler.cs.meta
  55. +5 −0 Assets/Scripts/Rewind/Commands.meta
  56. +5 −0 Assets/Scripts/Rewind/Commands/Animation.meta
  57. +30 −0 Assets/Scripts/Rewind/Commands/Animation/AnimationChangeCommand.cs
  58. +8 −0 Assets/Scripts/Rewind/Commands/Animation/AnimationChangeCommand.cs.meta
  59. +28 −0 Assets/Scripts/Rewind/Commands/ClimbLadderCommand.cs
  60. +8 −0 Assets/Scripts/Rewind/Commands/ClimbLadderCommand.cs.meta
  61. +24 −0 Assets/Scripts/Rewind/Commands/Command.cs
  62. +8 −0 Assets/Scripts/Rewind/Commands/Command.cs.meta
  63. +38 −0 Assets/Scripts/Rewind/Commands/CommandGroup.cs
  64. +8 −0 Assets/Scripts/Rewind/Commands/CommandGroup.cs.meta
  65. +27 −0 Assets/Scripts/Rewind/Commands/CrouchCommand.cs
  66. +8 −0 Assets/Scripts/Rewind/Commands/CrouchCommand.cs.meta
  67. +30 −0 Assets/Scripts/Rewind/Commands/EnemyDeadCommand.cs
  68. +8 −0 Assets/Scripts/Rewind/Commands/EnemyDeadCommand.cs.meta
  69. +34 −0 Assets/Scripts/Rewind/Commands/FlipCommand.cs
  70. +8 −0 Assets/Scripts/Rewind/Commands/FlipCommand.cs.meta
  71. +25 −0 Assets/Scripts/Rewind/Commands/IdleCommand.cs
  72. +8 −0 Assets/Scripts/Rewind/Commands/IdleCommand.cs.meta
  73. +26 −0 Assets/Scripts/Rewind/Commands/JumpCommand.cs
  74. +8 −0 Assets/Scripts/Rewind/Commands/JumpCommand.cs.meta
  75. +30 −0 Assets/Scripts/Rewind/Commands/MovementCommand.cs
  76. +8 −0 Assets/Scripts/Rewind/Commands/MovementCommand.cs.meta
  77. +75 −0 Assets/Scripts/Rewind/Commands/MovementWithPhysicsCommand.cs
  78. +8 −0 Assets/Scripts/Rewind/Commands/MovementWithPhysicsCommand.cs.meta
  79. +32 −0 Assets/Scripts/Rewind/Commands/PlayerDeadCommand.cs
  80. +8 −0 Assets/Scripts/Rewind/Commands/PlayerDeadCommand.cs.meta
  81. +50 −0 Assets/Scripts/Rewind/Commands/ShootLaserCommand.cs
  82. +8 −0 Assets/Scripts/Rewind/Commands/ShootLaserCommand.cs.meta
  83. +25 −0 Assets/Scripts/Rewind/Commands/SlimeDeadCommand.cs
  84. +8 −0 Assets/Scripts/Rewind/Commands/SlimeDeadCommand.cs.meta
  85. +122 −0 Assets/Scripts/Rewind/RewindHandler.cs
  86. +8 −0 Assets/Scripts/Rewind/RewindHandler.cs.meta
  87. +77 −0 Assets/Scripts/Rewind/RewindSceneController.cs
  88. +8 −0 Assets/Scripts/Rewind/RewindSceneController.cs.meta
  89. +22 −0 Assets/Scripts/Rewind/RewindSettings.cs
  90. +8 −0 Assets/Scripts/Rewind/RewindSettings.cs.meta
  91. +5 −0 Assets/Sprites.meta
  92. +5 −0 Assets/Sprites/Enemies.meta
  93. +5 −0 Assets/Sprites/Enemies/Bat.meta
  94. BIN Assets/Sprites/Enemies/Bat/Dead.anim
  95. +4 −0 Assets/Sprites/Enemies/Bat/Dead.anim.meta
  96. BIN Assets/Sprites/Enemies/Bat/Fly.anim
  97. +4 −0 Assets/Sprites/Enemies/Bat/Fly.anim.meta
  98. BIN Assets/Sprites/Enemies/Bat/bat.png
  99. +47 −0 Assets/Sprites/Enemies/Bat/bat.png.meta
  100. BIN Assets/Sprites/Enemies/Bat/bat_dead.png
  101. +47 −0 Assets/Sprites/Enemies/Bat/bat_dead.png.meta
  102. BIN Assets/Sprites/Enemies/Bat/bat_fly.png
  103. +47 −0 Assets/Sprites/Enemies/Bat/bat_fly.png.meta
  104. BIN Assets/Sprites/Enemies/Bat/bat_hang.controller
  105. +4 −0 Assets/Sprites/Enemies/Bat/bat_hang.controller.meta
  106. BIN Assets/Sprites/Enemies/Bat/bat_hang.png
  107. +47 −0 Assets/Sprites/Enemies/Bat/bat_hang.png.meta
  108. BIN Assets/Sprites/Enemies/Bat/hang.anim
  109. +4 −0 Assets/Sprites/Enemies/Bat/hang.anim.meta
  110. +5 −0 Assets/Sprites/Enemies/Slime.meta
  111. BIN Assets/Sprites/Enemies/Slime/dead.anim
  112. +4 −0 Assets/Sprites/Enemies/Slime/dead.anim.meta
  113. BIN Assets/Sprites/Enemies/Slime/slime.controller
  114. +4 −0 Assets/Sprites/Enemies/Slime/slime.controller.meta
  115. BIN Assets/Sprites/Enemies/Slime/slimeDead.png
  116. +47 −0 Assets/Sprites/Enemies/Slime/slimeDead.png.meta
  117. BIN Assets/Sprites/Enemies/Slime/slimeWalk1.png
  118. +47 −0 Assets/Sprites/Enemies/Slime/slimeWalk1.png.meta
  119. BIN Assets/Sprites/Enemies/Slime/slimeWalk2.png
  120. +47 −0 Assets/Sprites/Enemies/Slime/slimeWalk2.png.meta
  121. BIN Assets/Sprites/Enemies/Slime/walk.anim
  122. +4 −0 Assets/Sprites/Enemies/Slime/walk.anim.meta
  123. +5 −0 Assets/Sprites/Enemies/laser.meta
  124. BIN Assets/Sprites/Enemies/laser/laserBlueBurst.png
  125. +47 −0 Assets/Sprites/Enemies/laser/laserBlueBurst.png.meta
  126. BIN Assets/Sprites/Enemies/laser/laser_blue_horizontal.png
  127. +47 −0 Assets/Sprites/Enemies/laser/laser_blue_horizontal.png.meta
  128. BIN Assets/Sprites/Enemies/laser/laser_blue_vertical.png
  129. +47 −0 Assets/Sprites/Enemies/laser/laser_blue_vertical.png.meta
  130. BIN Assets/Sprites/Enemies/laser/laser_left.png
  131. +47 −0 Assets/Sprites/Enemies/laser/laser_left.png.meta
  132. BIN Assets/Sprites/Enemies/laser/laser_left_shoot.png
  133. +47 −0 Assets/Sprites/Enemies/laser/laser_left_shoot.png.meta
  134. BIN Assets/Sprites/Enemies/laser/laser_up.png
  135. +47 −0 Assets/Sprites/Enemies/laser/laser_up.png.meta
  136. BIN Assets/Sprites/Enemies/laser/laser_up_shoot.png
  137. +47 −0 Assets/Sprites/Enemies/laser/laser_up_shoot.png.meta
  138. +5 −0 Assets/Sprites/Environment.meta
  139. BIN Assets/Sprites/Environment/bg_grasslands.png
  140. +47 −0 Assets/Sprites/Environment/bg_grasslands.png.meta
  141. +5 −0 Assets/Sprites/Environment/ice.meta
  142. BIN Assets/Sprites/Environment/ice/spikesBottom.png
  143. +47 −0 Assets/Sprites/Environment/ice/spikesBottom.png.meta
  144. BIN Assets/Sprites/Environment/ice/spikesBottomAlt.png
  145. +47 −0 Assets/Sprites/Environment/ice/spikesBottomAlt.png.meta
  146. BIN Assets/Sprites/Environment/ice/spikesBottomAlt2.png
  147. +47 −0 Assets/Sprites/Environment/ice/spikesBottomAlt2.png.meta
  148. BIN Assets/Sprites/Environment/ice/spikesTop.png
  149. +47 −0 Assets/Sprites/Environment/ice/spikesTop.png.meta
  150. BIN Assets/Sprites/Environment/ice/spikesTopAlt.png
  151. +47 −0 Assets/Sprites/Environment/ice/spikesTopAlt.png.meta
  152. BIN Assets/Sprites/Environment/ice/spikesTopAlt2.png
  153. +47 −0 Assets/Sprites/Environment/ice/spikesTopAlt2.png.meta
  154. +5 −0 Assets/Sprites/Environment/ladder.meta
  155. BIN Assets/Sprites/Environment/ladder/ladder_mid.png
  156. +47 −0 Assets/Sprites/Environment/ladder/ladder_mid.png.meta
  157. BIN Assets/Sprites/Environment/ladder/ladder_top.png
  158. +47 −0 Assets/Sprites/Environment/ladder/ladder_top.png.meta
  159. +5 −0 Assets/Sprites/Environment/platform.meta
  160. +5 −0 Assets/Sprites/Environment/platform/choco.meta
  161. BIN Assets/Sprites/Environment/platform/choco/chocoLeft.png
  162. +47 −0 Assets/Sprites/Environment/platform/choco/chocoLeft.png.meta
  163. BIN Assets/Sprites/Environment/platform/choco/chocoMid.png
  164. +47 −0 Assets/Sprites/Environment/platform/choco/chocoMid.png.meta
  165. BIN Assets/Sprites/Environment/platform/choco/chocoRight.png
  166. +47 −0 Assets/Sprites/Environment/platform/choco/chocoRight.png.meta
  167. +5 −0 Assets/Sprites/Environment/platform/grass.meta
  168. BIN Assets/Sprites/Environment/platform/grass/grass_left.png
  169. +47 −0 Assets/Sprites/Environment/platform/grass/grass_left.png.meta
  170. BIN Assets/Sprites/Environment/platform/grass/grass_middle.png
  171. +47 −0 Assets/Sprites/Environment/platform/grass/grass_middle.png.meta
  172. BIN Assets/Sprites/Environment/platform/grass/grass_right.png
  173. +47 −0 Assets/Sprites/Environment/platform/grass/grass_right.png.meta
  174. BIN Assets/Sprites/Environment/platform/grass_center.png
  175. +47 −0 Assets/Sprites/Environment/platform/grass_center.png.meta
  176. +5 −0 Assets/Sprites/Environment/platform/ice.meta
  177. BIN Assets/Sprites/Environment/platform/ice/tundraLeft.png
  178. +47 −0 Assets/Sprites/Environment/platform/ice/tundraLeft.png.meta
  179. BIN Assets/Sprites/Environment/platform/ice/tundraMid.png
  180. +47 −0 Assets/Sprites/Environment/platform/ice/tundraMid.png.meta
  181. BIN Assets/Sprites/Environment/platform/ice/tundraRight.png
  182. +47 −0 Assets/Sprites/Environment/platform/ice/tundraRight.png.meta
  183. +5 −0 Assets/Sprites/Environment/platform/metal.meta
  184. BIN Assets/Sprites/Environment/platform/metal/metalLeft.png
  185. +47 −0 Assets/Sprites/Environment/platform/metal/metalLeft.png.meta
  186. BIN Assets/Sprites/Environment/platform/metal/metalMid.png
  187. +47 −0 Assets/Sprites/Environment/platform/metal/metalMid.png.meta
  188. BIN Assets/Sprites/Environment/platform/metal/metalRight.png
  189. +47 −0 Assets/Sprites/Environment/platform/metal/metalRight.png.meta
  190. +5 −0 Assets/Sprites/Environment/platform/small.meta
  191. BIN Assets/Sprites/Environment/platform/small/dirt_half_left.png
  192. +47 −0 Assets/Sprites/Environment/platform/small/dirt_half_left.png.meta
  193. BIN Assets/Sprites/Environment/platform/small/dirt_half_mid.png
  194. +47 −0 Assets/Sprites/Environment/platform/small/dirt_half_mid.png.meta
  195. BIN Assets/Sprites/Environment/platform/small/dirt_half_right.png
  196. +47 −0 Assets/Sprites/Environment/platform/small/dirt_half_right.png.meta
  197. BIN Assets/Sprites/Environment/sign_right.png
  198. +47 −0 Assets/Sprites/Environment/sign_right.png.meta
  199. +5 −0 Assets/Sprites/Player.meta
  200. BIN Assets/Sprites/Player/alienGreen.png
  201. +47 −0 Assets/Sprites/Player/alienGreen.png.meta
  202. BIN Assets/Sprites/Player/alienGreen_climb1.png
  203. +47 −0 Assets/Sprites/Player/alienGreen_climb1.png.meta
  204. BIN Assets/Sprites/Player/alienGreen_climb2.png
  205. +47 −0 Assets/Sprites/Player/alienGreen_climb2.png.meta
  206. BIN Assets/Sprites/Player/alienGreen_duck.png
  207. +47 −0 Assets/Sprites/Player/alienGreen_duck.png.meta
  208. BIN Assets/Sprites/Player/alienGreen_hurt.png
  209. +47 −0 Assets/Sprites/Player/alienGreen_hurt.png.meta
  210. BIN Assets/Sprites/Player/alienGreen_jump.png
  211. +47 −0 Assets/Sprites/Player/alienGreen_jump.png.meta
  212. BIN Assets/Sprites/Player/alienGreen_walk1.controller
  213. +4 −0 Assets/Sprites/Player/alienGreen_walk1.controller.meta
  214. BIN Assets/Sprites/Player/alienGreen_walk1.png
  215. +47 −0 Assets/Sprites/Player/alienGreen_walk1.png.meta
  216. BIN Assets/Sprites/Player/alienGreen_walk2.png
  217. +47 −0 Assets/Sprites/Player/alienGreen_walk2.png.meta
  218. BIN Assets/Sprites/Player/climb.anim
  219. +4 −0 Assets/Sprites/Player/climb.anim.meta
  220. BIN Assets/Sprites/Player/duck.anim
  221. +4 −0 Assets/Sprites/Player/duck.anim.meta
  222. BIN Assets/Sprites/Player/hurt.anim
  223. +4 −0 Assets/Sprites/Player/hurt.anim.meta
  224. BIN Assets/Sprites/Player/idle.anim
  225. +4 −0 Assets/Sprites/Player/idle.anim.meta
  226. BIN Assets/Sprites/Player/jump.anim
  227. +4 −0 Assets/Sprites/Player/jump.anim.meta
  228. BIN Assets/Sprites/Player/walk.anim
  229. +4 −0 Assets/Sprites/Player/walk.anim.meta
  230. +5 −0 Assets/Sprites/Rewind.meta
  231. BIN Assets/Sprites/Rewind/rewind.png
  232. +47 −0 Assets/Sprites/Rewind/rewind.png.meta
  233. BIN Assets/Sprites/signExit.png
  234. +47 −0 Assets/Sprites/signExit.png.meta
  235. BIN ProjectSettings/AudioManager.asset
  236. BIN ProjectSettings/DynamicsManager.asset
  237. BIN ProjectSettings/EditorBuildSettings.asset
  238. BIN ProjectSettings/EditorSettings.asset
  239. BIN ProjectSettings/GraphicsSettings.asset
  240. BIN ProjectSettings/InputManager.asset
  241. BIN ProjectSettings/NavMeshAreas.asset
  242. BIN ProjectSettings/NavMeshLayers.asset
  243. BIN ProjectSettings/NetworkManager.asset
  244. BIN ProjectSettings/Physics2DSettings.asset
  245. BIN ProjectSettings/ProjectSettings.asset
  246. +2 −0 ProjectSettings/ProjectVersion.txt
  247. BIN ProjectSettings/QualitySettings.asset
  248. BIN ProjectSettings/TagManager.asset
  249. BIN ProjectSettings/TimeManager.asset
  250. BIN ProjectSettings/UnityAdsSettings.asset
  251. BIN ProjectSettings/UnityAnalyticsManager.asset

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,93 @@
using UnityEngine;
using System.Collections;
namespace RewindController
{
[RequireComponent(typeof(CharacterRewindHandler))]
[RequireComponent(typeof(Animator))]
public class Bat : MonoBehaviour, IFlippable, IKillable
{
public Transform Player;
public bool FacingRight { get; set; }
public bool Dead { get; set; }
private float SightRadius = 10f;
private float MovementSpeed = 5f;
private bool firstSightOfPlayer = true;
private CharacterRewindHandler rewind;
private Animator animator;
// Use this for initialization
void Start ()
{
rewind = GetComponent<CharacterRewindHandler> ();
animator = GetComponent<Animator> ();
}
// Update is called once per frame
void Update ()
{
if (!rewind.Complete) {
firstSightOfPlayer = true;
return;
}
if (Dead) {
var gravity = new Vector2 (0, -1) * 16f;
rewind.AddCommand (new MovementCommand (transform, gravity * Time.deltaTime), true);
}
var heading = Player.position - transform.position;
var distance = heading.magnitude;
var dir = heading / distance;
if (distance < SightRadius) {
if (firstSightOfPlayer) {
rewind.AddCommand (new AnimationChangeCommand (animator, "playerInSight", true), true);
firstSightOfPlayer = false;
}
var move = dir * MovementSpeed;
rewind.AddCommand (new MovementCommand (transform, move * Time.deltaTime), true);
HandleSpriteFlip (move.x);
} else {
rewind.AddCommand (new IdleCommand (), false);
}
}
private void HandleSpriteFlip (float moveDirection)
{
if (moveDirection < 0 && FacingRight) {
rewind.AddCommand (new FlipCommand (transform, this), true);
} else if (moveDirection > 0 && !FacingRight) {
rewind.AddCommand (new FlipCommand (transform, this), true);
}
}
void OnTriggerEnter2D (Collider2D other)
{
if (!rewind.Complete || Dead)
return;
if (other.gameObject.CompareTag ("Player")) {
var player = other.gameObject.GetComponent<Player> ();
if (other.bounds.min.y >= transform.position.y) {
rewind.AddCommand (new EnemyDeadCommand (transform, this, animator), true);
player.JumpedOnEnemy ();
} else {
player.Dead = true;
}
}
}
}
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,16 @@
using UnityEngine;
using System.Collections;
namespace RewindController
{
public class KillPlayerOnTriggerEnter : MonoBehaviour
{
void OnTriggerEnter2D (Collider2D other)
{
if (other.gameObject.CompareTag ("Player")) {
other.gameObject.GetComponent<Player> ().Dead = true;
}
}
}
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,48 @@
using UnityEngine;
using System.Collections;
namespace RewindController
{
[RequireComponent(typeof(CharacterRewindHandler))]
public class Laser : MonoBehaviour
{
public float MovementSpeed = 20f;
public Vector2 Direction { get; set; }
private CharacterRewindHandler rewind;
// Use this for initialization
void Start ()
{
rewind = GetComponent<CharacterRewindHandler> ();
}
// Update is called once per frame
void Update ()
{
if (!rewind.Complete)
return;
var force = Direction * MovementSpeed;
rewind.AddCommand (new MovementCommand (transform, force * Time.deltaTime), true);
}
void OnTriggerEnter2D (Collider2D other)
{
if (!rewind.Complete)
return;
if (other.gameObject.CompareTag ("Player")) {
var player = other.gameObject.GetComponent<Player> ();
player.Dead = true;
}
}
}
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,65 @@
using UnityEngine;
using System.Collections;
namespace RewindController
{
[RequireComponent(typeof(SpriteRenderer))]
[RequireComponent(typeof(CharacterRewindHandler))]
public class LaserTurret : MonoBehaviour
{
public GameObject LaserPrefab;
public float ShootSpeed = 2.5f;
public Vector2 ShootDirection = new Vector2 (-1, 0);
public Sprite ShootSprite;
private SpriteRenderer rend;
private float currentShootSpeed = 0f;
private CharacterRewindHandler rewind;
// Use this for initialization
void Start ()
{
if (!LaserPrefab) {
Debug.LogError ("Please set laser prefab");
} else {
if (ShootSprite != null) {
rend = GetComponent<SpriteRenderer> ();
}
rewind = GetComponent<CharacterRewindHandler> ();
}
}
void Update ()
{
if (!rewind.Complete) {
currentShootSpeed -= Time.deltaTime;
if (currentShootSpeed < 0)
currentShootSpeed = 0f;
return;
}
currentShootSpeed += Time.deltaTime;
if (currentShootSpeed > ShootSpeed) {
currentShootSpeed = 0f;
rewind.AddCommand (new ShootLaserCommand (transform, ShootDirection, LaserPrefab, rend, ShootSprite), true);
} else {
rewind.AddCommand (new IdleCommand (), false);
}
}
}
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 03ec652

Please sign in to comment.