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(); }
public void Destroy() { if (TankView != null && TankModel != null) { TankView.Destroy(); TankModel = null; } return; }
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; }
public TankView GetTankView() { return(TankView.GetView()); }