Example #1
0
 public TankController(TankModel tankModel, TankView tankPrefab, Transform spawner)
 {
     TankModel = tankModel;
     TankView  = GameObject.Instantiate <TankView>(tankPrefab, spawner.transform.position, spawner.transform.rotation);
     TankView.InitialiseController(this);
     TankView.SetViewDetails();
 }
Example #2
0
 public void Destroy()
 {
     if (TankView != null && TankModel != null)
     {
         TankView.Destroy();
         TankModel = null;
     }
     return;
 }
Example #3
0
 public void ApplyDamage(float damage)
 {
     if (TankModel != null)
     {
         if ((TankModel.Health - damage) <= 0)
         {
             DestroyView();
         }
         else
         {
             TankModel.Health -= damage;
             Debug.Log(TankModel.Health);
             TankView.SetTankHealth(TankModel.Health);
         }
     }
     return;
 }
Example #4
0
 public TankView GetTankView()
 {
     return(TankView.GetView());
 }