SHOW:
|
|
- or go back to the newest paste.
| 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 | bAttack.onClick.AddListener(Attack); | |
| 16 | } | |
| 17 | ||
| 18 | public void Update() | |
| 19 | {
| |
| 20 | ||
| 21 | - | if (attack==true) |
| 21 | + | if (attack) |
| 22 | {
| |
| 23 | attack = false; | |
| 24 | // | |
| 25 | } | |
| 26 | ||
| 27 | } | |
| 28 | public void Attack() | |
| 29 | {
| |
| 30 | - | if (attack) |
| 30 | + | attack = !attack |
| 31 | - | {
|
| 31 | + | |
| 32 | - | attack = false; |
| 32 | + |