public virtual void SetUnitData(UnitData data) { Health.SetHealth(data.Health); transform.position = data.Position; transform.eulerAngles = new Vector3(0, data.YRotation, 0); // TODO: Set gameobject active? }
public override void Respawn() { life -= 1; if (life > 0) { Health.SetHealth(100); transform.position = startPosition; } else { Destroy(gameObject); SceneManager.LoadScene("PlayerLost"); } }
protected virtual void HandleUnitDied(Unit unit) { GameManager.Instance.MessageBus.Publish(new UnitDiedMessage(this)); //gameObject.SetActive( false ); Health.SetHealth(_startingHealth); if (this is EnemyUnit) { transform.position = FindObjectOfType <EnemySpawn>().transform.position; } else { transform.position = FindObjectOfType <PlayerSpawn>().transform.position; GetComponent <PlayerUnit>()._livesLeft--; } }
/// <summary> /// Sets loaded data to this unit. /// </summary> /// <param name="data">Unit data</param> public void SetUnitData(UnitData data) { Health.SetHealth(data.Health, true); RemainingRespawnTime = data.RemainingRespawnTime; transform.position = data.Position; Vector3 newRotation = transform.rotation.eulerAngles; newRotation.y = data.YRotation; transform.rotation = Quaternion.Euler(newRotation); ID = data.ID; if (Health.IsDead) { tankModel.SetActive(false); GameManager.Instance.SpawnDestroyedTank(this); } else { tankModel.SetActive(true); ResetTankHead(); } }
public virtual void Recycle() { transform.position = _initialPosition; Health.SetHealth(_startingHealth); }
public override void Respawn() { Health.SetHealth(50); transform.position = startPosition; }
/// <summary> /// Sets unit healt to starting healt and position to zero. Or if commented keeps the current position. /// </summary> public void Respawn() { Health.SetHealth(_startingHealth); transform.position = new Vector3(0, 0, 0); }