/** TODO * - zeby loot dalo sie zebrac dopiero jak upadnie z pociagu na ziemie * - zeby nie dalo sie wchodzic na pociag * - zeby w okienku na gorze bylo widac ikonki typow lootu i ile ich mamy * - zeby player ginal przy zderzeniu z pociagiem */ void OnTriggerStay(Collider collider) { Debug.Log(collider.name); if (collider.tag == "Pickable") { Debug.Log("pickable"); if (Input.GetButton("Use")) { GameObject itemObject = collider.transform.gameObject; AbsPickable pickable = collider.GetComponentInParent <AbsPickable> (); if (pickable is AbsItem) { bool wasItemPickedUp = inventoryBuilder.AddItemToInventory(itemObject); if (wasItemPickedUp) { pickable.OnBeingPicked(); InfoPanelManager.AddNewMessage(Strings.pickUpItem + pickable.GetName()); } } } AbsLoot loot = collider.GetComponentInParent <AbsLoot> (); if (loot != null) { Debug.Log("with loot"); loot.OnBeingPicked(); lootInventoryBuilder.PutLoot(loot); InfoPanelManager.AddNewMessage(Strings.pickUpLoot + loot.GetName()); } } }
public bool RemoveLoot(AbsLoot loot) { Type type = loot.GetType(); if (dictionary.ContainsKey(type)) { dictionary [type] = dictionary [type] - 1; --totalCount; return(true); } return(false); }
public void PutLoot(AbsLoot loot) { Type type = loot.GetType(); if (dictionary.ContainsKey(type)) { dictionary [type] = dictionary [type] + 1; } else { dictionary.Add(type, 1); } ++totalCount; Debug.Log(totalCount + " loots"); Debug.Log(dictionary); }
private void Shoot() { Debug.Log("Fire!"); timer = 0f; //gunAudio.Play (); gunLight.enabled = true; gunParticles.Stop(); gunParticles.Play(); gunLine.enabled = true; gunLine.SetPosition(0, transform.position); shootRay.origin = transform.position; shootRay.direction = transform.forward; if (Physics.Raycast(shootRay, out shootHit, range, shootableMask)) { Debug.Log("Hostile inbound!"); AbsHostile hostile = shootHit.collider.GetComponent <AbsHostile>(); if (hostile != null) { hostile.TakeDamage(damage); } AbsLoot loot = shootHit.collider.GetComponent <AbsLoot>(); Debug.Log("Loot is: " + loot); if (loot != null) { loot.Push(shootRay.direction); } gunLine.SetPosition(1, shootHit.point); } else { gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range); } }
public int GetLootCount(AbsLoot loot) { Type type = loot.GetType(); return(dictionary.ContainsKey(type) ? dictionary [type] : 0); }