コード例 #1
0
    // Use this for initialization
    void Start()
    {
        sumo = GetComponent <SumoWeight>();

        playerRenderer   = GetComponent <MeshRenderer>();
        playerController = GetComponent <PlayerController>();
    }
コード例 #2
0
    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);
        }
    }
コード例 #3
0
 public void Respawn(SumoWeight sumo)
 {
     //Out of Bounds or Blowfish
     if (!isRespawning)
     {
         HealthManager.SetPlayerRenderer(sumo);
         StartCoroutine(RespawnCo(sumo));
     }
 }
コード例 #4
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         SumoWeight sumoWeight = other.gameObject.GetComponent <SumoWeight>();
         if (sumoWeight != null)
         {
             sumoWeight.RespawnPlayer();
         }
     }
 }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
    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;
    }
コード例 #7
0
 public static void SetPlayerRenderer(SumoWeight sw)
 {
     playerRenderer = sw.GetComponent <MeshRenderer>();
 }