int x; //material array 길이 저장 private void Awake() { player = GameObject.Find("Player"); forPickup = player.GetComponent <pickup>(); //gazedAt = false; }
private void Awake() { Glob = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth>(); Glow = GameObject.FindGameObjectWithTag("GlowBar").GetComponent <PlayerGlow>(); EatBGlow = GameObject.FindGameObjectWithTag("GainGlow").GetComponent <Image>(); BabyHealth = GetComponent <BabyHealth>(); pickup = GetComponent <pickup>(); }
void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "pickup") { Debug.Log("hit"); pickup script = coll.gameObject.GetComponent <pickup>(); int value = script.getValue(); this.SendMessage("addDNA", value); Destroy(coll.gameObject); } }
public void CombineToNewEntity(pickup other, GameObject prefab) { this.interactable = false; other.interactable = false; var newEntity = Instantiate(prefab); newEntity.transform.position = other.transform.position; if (newEntity.GetComponent <pickup>() != null) { newEntity.GetComponent <pickup>().currentOwner = this.currentOwner; this.currentOwner.carryingObject = newEntity.GetComponent <pickup>(); } this.OnConsume(); other.OnConsume(); }
private void Awake() { inven = false; invLight.SetActive(false); movement = player.GetComponent <move>(); //예진// crouch = player.GetComponent <Crouch>(); cubeCamera = player.transform.GetChild(0).gameObject; pick = player.GetComponent <pickup>(); rb = player.GetComponent <Rigidbody>(); point = GvrReticle.GetComponent <GvrReticlePointer>(); total_weight = 0; }
public override void OnInteractWithPickup(pickup other) { switch (other.type) { case PickupType.Honey: CombineToNewEntity(other, EntityPrefabHolder.instance.beePrefab); break; case PickupType.Wax: CombineToNewEntity(other, PickupPrefabHolder.instance.larvaPickupPrefab); break; case PickupType.Polen: CombineToNewEntity(other, PickupPrefabHolder.instance.waxPickupPrefab); break; } }
void interactWithItems(List <Transform> Items) { float distance = 0; int closestItem = 0; for (int i = 0; i < Items.Count; i++) { float d = Vector3.Distance(transform.position, Items[i].transform.position); if (d < distance) { distance = d; closestItem = i; } } pickup item = Items[closestItem].GetComponent <pickup>(); if (lastClosestItem != Items[closestItem]) { //stop highlighting opd item if (lastClosestItem != null) { lastClosestItem.GetComponent <pickup>().Highlight(false); } //highlight new item item.Highlight(true); } lastClosestItem = Items[closestItem]; if (inputManager.instance.interactButton == true) { inventory.Add(item.item); Destroy(item.gameObject); } }
static void Main(string[] args) { List<Vehicle> aList = new List<Vehicle>(); aList.Add(new Car("Ford","Mustang", 20000,20,2)); aList.Add(new pickup("Toyota", "Tundra", "Extended", 15000)); aList.Sort(); aList.Reverse(); for (int i = 0; i < 10; i++) Console.WriteLine(aList[i]); Vehicle V = new Car(); Console.WriteLine("V's Score = {0}", V.score()); V = new pickup(); Console.WriteLine("V's Score = {0}", V.score()); Random aRan = new Random(); if (aRan.Next() % 2 == 1) V = new Car(); else V = new pickup(); Console.WriteLine("V's Score = {0}", V.score()); Car aCar = new Car(); aCar.make = "Toyota"; aCar.model = "Rav4"; aCar.MPG = 30; /* * less than 0 is 1 < 2 * Zero if 1 = 2 * greater than id 1 > 2 */ Console.ReadKey(); }
public virtual void OnInteractWithPickup(pickup p) { // Implementar em classes filhas }