Advertisement
Guest User

Untitled

a guest
Oct 5th, 2022
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.AI;
  5. using UnityEngine.UI;
  6.  
  7. public class WarController : MonoBehaviour
  8. {
  9. public bool attack;
  10. public Button bAttack;
  11.  
  12. public void Start()
  13. {
  14. attack = false;
  15. }
  16.  
  17. public void Update()
  18. {
  19. bAttack.onClick.AddListener(Attack);
  20.  
  21. if (attack==true)
  22. {
  23. //
  24. }
  25.  
  26. }
  27. public void Attack()
  28. {
  29.  
  30. if (attack)
  31. {
  32. attack = false;
  33. Debug.Log(attack);
  34. }
  35. else
  36. {
  37. attack = true;
  38. Debug.Log(attack);
  39. }
  40.  
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement