Exemple #1
0
        public TankController(TankScriptableObject tankProps)
        {
            model = new TankModel();
            view  = GameObject.Instantiate(tankProps.tankPrefab);
            view.SetController(this);
            shellPool = new ShellPool(tankProps.shellPrefab);
            tankType  = tankProps.tankType;

            shellPrefab = tankProps.shellPrefab;
        }
Exemple #2
0
 public void TakeDamage(float damage)
 {
     model.TakeDamage(damage);
     if (model.Health == 0)
     {
         view.DestroyView();
         view = null;
         if (tankType == TankType.PlayerTank)
         {
             GameplayService.Instance.GameOver(false);
         }
         else
         {
             GameplayService.Instance.GameOver(true);
         }
     }
 }