1- using UnityEngine ;
1+ using UnityEngine ;
22
33public enum Flag
44{
@@ -7,6 +7,9 @@ public enum Flag
77 DEFENDING
88}
99
10+ /// <summary>
11+ /// Базовый класс для описания действий
12+ /// </summary>
1013public abstract class Action : MonoBehaviour
1114{
1215 public Flag Flag ;
@@ -15,18 +18,18 @@ public abstract class Action : MonoBehaviour
1518 [ SerializeField ]
1619 private float _dragSensivity = 1.2f ;
1720
18- protected Character _target ;
21+ protected Character Target ;
1922 private LineRenderer _line ;
2023 private Camera _mainCamera ;
2124 private Vector3 _mouseOffset ;
2225 private float _mouseZCoord ;
2326 private Vector3 _firstPos ;
2427 private Renderer _meshRenderer ;
2528 private Transform _childOther ;
26- protected bool _isDraggable = false ;
27- protected bool _isSelfTargeted = false ;
28- protected bool _isEnemyTargeted = false ;
29- protected bool _isAttacking
29+ protected bool IsDraggable = false ;
30+ protected bool IsSelfTargeted = false ;
31+ protected bool IsEnemyTargeted = false ;
32+ protected bool IsAttacking
3033 {
3134 get
3235 {
@@ -45,7 +48,7 @@ private void Awake()
4548
4649 protected void Start ( )
4750 {
48- if ( ! Character . isEnemy ( transform . position ) ) _isDraggable = true ;
51+ if ( ! Character . isEnemy ( transform . position ) ) IsDraggable = true ;
4952 }
5053
5154 private Vector3 GetMouseWorldPosition ( )
@@ -58,7 +61,7 @@ private Vector3 GetMouseWorldPosition()
5861
5962 private void OnMouseDown ( )
6063 {
61- if ( ! _isDraggable ) return ;
64+ if ( ! IsDraggable ) return ;
6265
6366 Cursor . visible = false ;
6467 _line = Instantiate ( _linePrefab , Vector3 . zero , Quaternion . identity ) . GetComponent < LineRenderer > ( ) ;
@@ -75,7 +78,7 @@ private void OnMouseDown()
7578
7679 private void OnMouseDrag ( )
7780 {
78- if ( ! _isDraggable ) return ;
81+ if ( ! IsDraggable ) return ;
7982
8083 Vector3 newPos = ( GetMouseWorldPosition ( ) + _mouseOffset ) * _dragSensivity ;
8184 transform . position = new Vector3 ( newPos . x , _firstPos . y , newPos . z ) ;
@@ -85,7 +88,7 @@ private void OnMouseDrag()
8588
8689 private void OnMouseUp ( )
8790 {
88- if ( ! _isDraggable ) return ;
91+ if ( ! IsDraggable ) return ;
8992
9093 gameObject . AddComponent < Rigidbody > ( ) ;
9194 Destroy ( _line . gameObject ) ;
@@ -94,11 +97,11 @@ private void OnMouseUp()
9497
9598 public void SetTarget ( Character target , out bool performable )
9699 {
97- if ( _isSelfTargeted )
100+ if ( IsSelfTargeted )
98101 {
99102 if ( target . gameObject . Equals ( transform . parent . gameObject ) )
100103 {
101- _target = target ;
104+ Target = target ;
102105 performable = true ;
103106 }
104107 else
@@ -107,16 +110,16 @@ public void SetTarget(Character target, out bool performable)
107110 performable = false ;
108111 }
109112 }
110- else if ( ! _isDraggable )
113+ else if ( ! IsDraggable )
111114 {
112- _target = target ;
115+ Target = target ;
113116 performable = true ;
114117 }
115- else if ( _isEnemyTargeted )
118+ else if ( IsEnemyTargeted )
116119 {
117120 if ( Character . isEnemy ( target . transform . position ) )
118121 {
119- _target = target ;
122+ Target = target ;
120123 performable = true ;
121124 }
122125 else
0 commit comments