/// <summary> /// Respawns this object at its spawn position. This resets the health to maximum. /// </summary> void Respawn() { hpCurrent = hpMax; transform.position = spawnPosition; LayerFixed zControl = GetComponent <LayerFixed>(); if (zControl) { zControl.z = (int)(spawnPosition.z / LayerFixed.separation); } }
/// <summary> /// Initializes the object. Called when spawning. /// </summary> void Start() { PlayerController.player = this; pawn = GetComponent <CharacterController>(); layerController = GetComponent <LayerFixed>(); DeriveJumpValues(); if (prefabHUD) { HUDController playerHUD = Instantiate(prefabHUD); playerHUD.SetPlayer(this); } }