Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class ComboSystem : MonoBehaviour {
- private int point = 1;
- private int point2 = 1;
- private int totalCombo = 4;
- private float timer = 0;
- private float timer2 = 0;
- public Animator anim;
- void Start () {
- }
- void Update () {
- Puntos ();
- tiempoentrecombos ();
- combo ();
- print (point2);
- }
- void Puntos(){
- //anim.SetBool ("Atacando", false);
- //if (point <= totalCombo) {
- if (Input.GetKeyDown (KeyCode.Z)) {
- //anim.SetBool ("Atacando", true);
- timer = 1;
- point += 1;
- }
- if (Input.GetKeyDown (KeyCode.C)) {
- timer2 = 1;
- point2 += 1;
- }
- //} else {
- //point = 1;
- /*anim.SetBool ("hit1", false);
- anim.SetBool ("hit2", false);
- anim.SetBool ("hit3", false);
- anim.SetBool ("hit4", false);*/
- //}
- }
- void tiempoentrecombos(){
- if (timer > 0) {
- timer -= Time.deltaTime;
- }
- if (timer2 > 0) {
- timer2 -= Time.deltaTime;
- }
- if (timer <= 0) {
- point = 1;
- }
- if (timer2 <= 0) {
- point2 = 1;
- }
- if(point == 1 || point2 == 1){
- anim.SetBool ("hit1", false);
- anim.SetBool ("hit2", false);
- anim.SetBool ("hit3", false);
- anim.SetBool ("hit4", false);
- anim.SetBool ("hit5", false);
- }
- }
- void combo(){
- if (point == 1) {
- //print ("1");
- }
- if (point == 2 && !anim.GetCurrentAnimatorStateInfo(0).IsName("Espada")) {
- //print ("2");
- anim.SetBool ("hit1", true);
- }
- if (point == 3) {
- //print ("3");
- anim.SetBool ("hit2", true);
- }
- if (point == 4) {
- anim.SetBool ("hit3", true);
- }
- if (point == 3 && point2 == 2) {
- anim.SetBool ("hit4", true);
- }
- if (point2 == 3) {
- anim.SetBool ("hit5", true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement