Advertisement
dronkowitz

BaseCharacter.cs

Nov 3rd, 2021
1,376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public abstract class BaseCharacter : MonoBehaviour
  6. {
  7.     float holdTimer = 0;
  8.     bool useTimer = false;
  9.     // Start is called before the first frame update
  10.     void Start()
  11.     {
  12.        
  13.     }
  14.  
  15.     // Update is called once per frame
  16.     void Update()
  17.     {
  18.         if (useTimer)
  19.         {
  20.             holdTimer += Time.deltaTime;
  21.         }
  22.         if (Input.GetKeyDown(KeyCode.B))
  23.         {
  24.             useTimer = true;
  25.         }
  26.  
  27.         if (Input.GetKeyUp(KeyCode.B))
  28.         {
  29.             if (holdTimer < 0.2f)
  30.             {
  31.                 //Regular Attack
  32.             }
  33.             else
  34.             {
  35.                 //Power Attack
  36.             }
  37.         }
  38.     }
  39.  
  40.     public abstract void PowerAttack();
  41.     public abstract void RegularAttack();
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement