Advertisement
gotoheavenbro

Food.cs

Nov 20th, 2014
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.38 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Food : MonoBehaviour {
  5.     public float Weight;
  6.     public GameObject foodholder;
  7.    
  8.     public void Eaten(float t)
  9.     {
  10.         Weight -= t;
  11.         if (Weight <= 0)
  12.         {
  13.             foodholder.GetComponent<FoodHolder>()._foodList.Remove(gameObject); ;
  14.             Destroy(gameObject);
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement