// Use this for initialization void Start() { sumo = GetComponent <SumoWeight>(); playerRenderer = GetComponent <MeshRenderer>(); playerController = GetComponent <PlayerController>(); }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { SumoWeight sumoWeight = other.gameObject.GetComponent <SumoWeight>(); if (sumoWeight != null) { switch (_foodType) { case FoodType.healthy: sumoWeight.AddHealthToPlayer(value); FindObjectOfType <FoodManager>().AddSize(value); break; case FoodType.spoiled: sumoWeight.RemoveHealthFromPlayer(value); FindObjectOfType <FoodManager>().RemoveSize(value); break; case FoodType.deadly: sumoWeight.KillPlayer(); break; default: break; } } Destroy(gameObject); } }
public void Respawn(SumoWeight sumo) { //Out of Bounds or Blowfish if (!isRespawning) { HealthManager.SetPlayerRenderer(sumo); StartCoroutine(RespawnCo(sumo)); } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { SumoWeight sumoWeight = other.gameObject.GetComponent <SumoWeight>(); if (sumoWeight != null) { sumoWeight.RespawnPlayer(); } } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { FindObjectOfType <FoodManager>().RemoveSize(value); SumoWeight sumoWeight = other.gameObject.GetComponent <SumoWeight>(); if (sumoWeight != null) { sumoWeight.RemoveHealthFromPlayer(value); } Destroy(gameObject); } }
public IEnumerator RespawnCo(SumoWeight sumo) { isRespawning = true; sumo.gameObject.SetActive(false); yield return(new WaitForSeconds(respawnLength)); isRespawning = false; sumo.gameObject.SetActive(true); sumo.transform.position = respawnPoint; //invul frames invincibilityCounter = invincibilityLength; playerRenderer.enabled = false; flashCounter = flashLength; }
public static void SetPlayerRenderer(SumoWeight sw) { playerRenderer = sw.GetComponent <MeshRenderer>(); }