File tree Expand file tree Collapse file tree 12 files changed +60
-71
lines changed
ScriptableObjects/Databases Expand file tree Collapse file tree 12 files changed +60
-71
lines changed Original file line number Diff line number Diff line change @@ -15,15 +15,22 @@ MonoBehaviour:
15
15
_teams :
16
16
- _teamName : Player
17
17
_allyTeams :
18
- - Aliance
18
+ - _teamName : Aliance
19
+ _inSightBehaviour : 0
19
20
_enemiesTeams :
20
- - Enemy
21
+ - _teamName : Corp
22
+ _inSightBehaviour : 0
21
23
- _teamName : Aliance
22
24
_allyTeams :
23
- - Player
25
+ - _teamName : Player
26
+ _inSightBehaviour : 5
24
27
_enemiesTeams :
25
- - Enemy
26
- - _teamName : Enemy
28
+ - _teamName : Corp
29
+ _inSightBehaviour : 3
30
+ - _teamName : Corp
27
31
_allyTeams : []
28
32
_enemiesTeams :
29
- - Player
33
+ - _teamName : Aliance
34
+ _inSightBehaviour : 3
35
+ - _teamName : Player
36
+ _inSightBehaviour : 3
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public override void OnInspectorGUI()
16
16
{
17
17
base . OnInspectorGUI ( ) ;
18
18
19
- FindObjectOfType < GameVariables > ( ) . Awake ( ) ;
19
+ FindObjectOfType < GameController > ( ) . Awake ( ) ;
20
20
EditorGUI . BeginChangeCheck ( ) ;
21
21
22
22
BoxEntity box = target . GetComponent < BoxEntity > ( ) ;
Original file line number Diff line number Diff line change @@ -40,9 +40,9 @@ private void TryDamage(RaycastHit hit)
40
40
41
41
var unit = hit . collider . GetComponent < Unit > ( ) ;
42
42
unit ? . Damage ( _damage ) ;
43
- if ( GameVariables . hitBoxPopupState )
43
+ if ( GameController . hitBoxPopupState )
44
44
{
45
- var hitPopup = Instantiate ( GameVariables . gamePrefabDatabase . hitPopupPrefab ) as HitPopup ;
45
+ var hitPopup = Instantiate ( GameController . gamePrefabDatabase . hitPopupPrefab ) as HitPopup ;
46
46
hitPopup . transform . position = hit . point ;
47
47
hitPopup . Setup ( _damage ) ;
48
48
}
Original file line number Diff line number Diff line change @@ -13,15 +13,15 @@ public class ItemBox : BoxEntity
13
13
ItemObject _itemObject ;
14
14
15
15
public ItemBox ( ItemObject itemObject ) => _itemObject = itemObject ;
16
- public override List < ItemObject > boxContent => GameVariables . GetAllItems ( ) ;
16
+ public override List < ItemObject > boxContent => GameController . GetAllItems ( ) ;
17
17
public override string boxContentName => "Item" ;
18
18
19
19
20
20
void Start ( ) => Setup ( _selectedIndex ) ;
21
21
public override void Setup ( int itemIndex )
22
22
{
23
23
if ( itemIndex < 1 ) return ;
24
- _itemObject = GameVariables . GetItem ( itemIndex - 1 ) ;
24
+ _itemObject = GameController . GetItem ( itemIndex - 1 ) ;
25
25
_nameText . text = _itemObject . localizedName ;
26
26
}
27
27
Original file line number Diff line number Diff line change @@ -12,15 +12,15 @@ public class WeaponBox : BoxEntity
12
12
13
13
public WeaponBox ( WeaponObject weaponObject ) => _weaponObject = weaponObject ;
14
14
15
- public override List < ItemObject > boxContent => GameVariables . GetAllWeapons ( ) . Cast < ItemObject > ( ) . ToList ( ) ;
15
+ public override List < ItemObject > boxContent => GameController . GetAllWeapons ( ) . Cast < ItemObject > ( ) . ToList ( ) ;
16
16
public override string boxContentName => "Weapon" ;
17
17
18
18
19
19
void Start ( ) => Setup ( _selectedIndex ) ;
20
20
public override void Setup ( int itemIndex )
21
21
{
22
22
if ( itemIndex < 1 ) return ;
23
- _weaponObject = GameVariables . GetWeapon ( itemIndex - 1 ) ;
23
+ _weaponObject = GameController . GetWeapon ( itemIndex - 1 ) ;
24
24
_nameText . text = _weaponObject . localizedName ;
25
25
}
26
26
public override void Pickup ( Unit player )
Original file line number Diff line number Diff line change
1
+ using Reckless . Items ;
1
2
using System . Collections ;
2
3
using System . Collections . Generic ;
4
+ using Reckless . Entities ;
3
5
using UnityEngine ;
6
+ using UnityEngine . Serialization ;
4
7
5
8
namespace Reckless
6
9
{
7
10
public class GameController : MonoBehaviour
8
11
{
9
- // Start is called before the first frame update
10
- void Start ( )
11
- {
12
+ public static GameController instance { get ; private set ; }
12
13
13
- }
14
+ [ SerializeField ] ItemsDatabase _itemsDatabase ;
15
+ [ SerializeField ] WeaponsDatabase _weaponsDatabase ;
16
+ [ SerializeField ] GamePrefabDatabase _gamePrefabDatabase ;
17
+ [ SerializeField ] UnitTeamDatabase _unitTeamDatabase ;
18
+ [ SerializeField ] bool _hitBoxPopupState = true ;
19
+
20
+
21
+ public static GamePrefabDatabase gamePrefabDatabase => instance . _gamePrefabDatabase ;
22
+ public static bool hitBoxPopupState => instance . _hitBoxPopupState ;
14
23
15
- // Update is called once per frame
16
- void Update ( )
24
+ public void Awake ( )
17
25
{
18
-
26
+ instance = this ;
19
27
}
28
+
29
+ public static ItemObject GetItem ( string id ) => instance . _itemsDatabase ? . GetItem ( id ) ;
30
+ public static UnitTeam GetTeam ( string name ) => instance . _unitTeamDatabase ? . teams . Find ( x => x . teamName == name ) ;
31
+ public static ItemObject GetItem ( int index ) => instance . _itemsDatabase ? . GetItem ( index ) ;
32
+ public static List < ItemObject > GetAllItems ( ) => instance . _itemsDatabase ? . GetAllItems ( ) ;
33
+ public static WeaponObject GetWeapon ( string id ) => instance . _weaponsDatabase ? . GetWeapon ( id ) ;
34
+ public static WeaponObject GetWeapon ( int index ) => instance . _weaponsDatabase ? . GetWeapon ( index ) ;
35
+ public static List < WeaponObject > GetAllWeapons ( ) => instance . _weaponsDatabase ? . GetAllWeapons ( ) ;
20
36
}
21
- }
37
+ }
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ public class Npc : Unit
13
13
[ SerializeField ] List < NpcAbility > _abilities ;
14
14
15
15
[ SerializeField ] NpcState _npcState ;
16
+ [ SerializeField ] string _npcTeam ;
17
+ public UnitTeam npcTeam => GameController . GetTeam ( _npcTeam ) ;
16
18
public NpcState npcState => _npcState ;
17
19
18
20
[ SerializeField ] Unit _goal ;
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ public class NpcSightAbility : NpcAbility
10
10
[ SerializeField ] float _sightAngle = 120 ;
11
11
[ SerializeField ] List < Unit > _unitsInSight ;
12
12
[ SerializeField ] Vector3 _scanOffset ;
13
+
14
+ [ SerializeField ] NpcState _stateOnSeeAnyone ;
13
15
14
16
public List < Unit > unitsInSight => _unitsInSight ;
15
17
public override void PerformUpdate ( Npc npc )
Original file line number Diff line number Diff line change
1
+ using Reckless . Units . AI ;
1
2
using System . Collections ;
2
3
using System . Collections . Generic ;
3
4
using UnityEngine ;
@@ -8,7 +9,15 @@ namespace Reckless
8
9
public class UnitTeam
9
10
{
10
11
[ SerializeField ] string _teamName ;
11
- [ SerializeField ] List < string > _allyTeams ;
12
- [ SerializeField ] List < string > _enemiesTeams ;
12
+ public string teamName => _teamName ;
13
+ [ SerializeField ] List < TeamRule > _allyTeams ;
14
+ [ SerializeField ] List < TeamRule > _enemiesTeams ;
15
+
16
+ [ System . Serializable ]
17
+ public class TeamRule
18
+ {
19
+ [ SerializeField ] string _teamName ;
20
+ [ SerializeField ] NpcState _inSightBehaviour ;
21
+ }
13
22
}
14
23
}
You can’t perform that action at this time.
0 commit comments