Advertisement
Crazist

AI

Aug 18th, 2022
713
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 KB | None | 0 0
  1. namespace GamePlay.Units
  2. {
  3.     public class UnitsAI : IDisposable, IUpdate
  4.     {
  5.         private int coins;
  6.         private int maxCoins = 5;
  7.  
  8.         private GameObject prefab;
  9.         private NomandsComponet nomandsComponet;
  10.         private CollisionComponent collision;
  11.         private CoinInUnits coinInUnits;
  12.         private IJob State;
  13.        
  14.        
  15.         private event Action collectCoin;
  16.         public UnitsAI(GameObject _prefab, NomandsComponet _nomandsComponet, GameCycle _cyrcle, Pools _CoinPool)
  17.         {
  18.             State = new NomandState();
  19.             prefab = _prefab;
  20.             collision = _prefab.GetComponent<CollisionComponent>();
  21.             coinInUnits = new CoinInUnits(collision, coins, maxCoins, _CoinPool, _prefab, State);
  22.             ActionAdd();
  23.             collision.AddAction(collectCoin);
  24.             nomandsComponet = _nomandsComponet;
  25.             _cyrcle.Add(coinInUnits);
  26.         }
  27.        
  28.         private void ActionAdd()
  29.         {
  30.             collectCoin += coinInUnits.AddCoin;
  31.         }
  32.         public void Dispose()
  33.         {
  34.             collectCoin -= coinInUnits.AddCoin;
  35.         }
  36.  
  37.         public void OnUpdate()
  38.         {
  39.            
  40.         }
  41.     }
  42. }
  43.  
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement