Advertisement
Sluggma

Untitled

May 28th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ComboSystem : MonoBehaviour {
  5. private int point = 1;
  6. private int point2 = 1;
  7. private int totalCombo = 4;
  8. private float timer = 0;
  9. private float timer2 = 0;
  10. public Animator anim;
  11. void Start () {
  12.  
  13. }
  14. void Update () {
  15. Puntos ();
  16. tiempoentrecombos ();
  17. combo ();
  18. print (point2);
  19.  
  20. }
  21. void Puntos(){
  22. //anim.SetBool ("Atacando", false);
  23. //if (point <= totalCombo) {
  24. if (Input.GetKeyDown (KeyCode.Z)) {
  25. //anim.SetBool ("Atacando", true);
  26. timer = 1;
  27. point += 1;
  28. }
  29. if (Input.GetKeyDown (KeyCode.C)) {
  30. timer2 = 1;
  31. point2 += 1;
  32. }
  33. //} else {
  34. //point = 1;
  35. /*anim.SetBool ("hit1", false);
  36. anim.SetBool ("hit2", false);
  37. anim.SetBool ("hit3", false);
  38. anim.SetBool ("hit4", false);*/
  39. //}
  40. }
  41. void tiempoentrecombos(){
  42. if (timer > 0) {
  43. timer -= Time.deltaTime;
  44. }
  45. if (timer2 > 0) {
  46. timer2 -= Time.deltaTime;
  47. }
  48. if (timer <= 0) {
  49. point = 1;
  50. }
  51. if (timer2 <= 0) {
  52. point2 = 1;
  53. }
  54. if(point == 1 || point2 == 1){
  55. anim.SetBool ("hit1", false);
  56. anim.SetBool ("hit2", false);
  57. anim.SetBool ("hit3", false);
  58. anim.SetBool ("hit4", false);
  59. anim.SetBool ("hit5", false);
  60. }
  61. }
  62. void combo(){
  63. if (point == 1) {
  64. //print ("1");
  65. }
  66. if (point == 2 && !anim.GetCurrentAnimatorStateInfo(0).IsName("Espada")) {
  67. //print ("2");
  68. anim.SetBool ("hit1", true);
  69. }
  70. if (point == 3) {
  71. //print ("3");
  72. anim.SetBool ("hit2", true);
  73. }
  74. if (point == 4) {
  75. anim.SetBool ("hit3", true);
  76. }
  77. if (point == 3 && point2 == 2) {
  78. anim.SetBool ("hit4", true);
  79. }
  80. if (point2 == 3) {
  81. anim.SetBool ("hit5", true);
  82. }
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement