Ejemplo n.º 1
0
    //TODO: two separate timers - one for day, one for night

    // Update is called once per frame
    void Update()
    {
        lerpControl   += Time.deltaTime / duration;
        dayNight.color = Color.Lerp(day, night, lerpControl);
        if (dayNight.color == night)
        {
            ItemsInInventory.AddInventoryItemsToCampResource();
            SceneManager.LoadScene("T-MinusDays");
        }
    }
Ejemplo n.º 2
0
 public void AddAllItemsToPack()
 {
     foreach (var item in ItemsInInventory)
     {
         ItemsInPack.Add(item);
     }
     ItemsInInventory.Clear();
     CalculatePackWeight();
     Console.WriteLine("Added All Items to Pack");
 }
Ejemplo n.º 3
0
        public void RemoveAllItemsFromPack()
        {
            for (int i = 0; i < ItemsInPack.Count; i++)
            {
                ItemsInInventory.Add(ItemsInPack[i]);
            }

            ItemsInPack.Clear();
            CalculatePackWeight();
            Console.WriteLine("Removed All Items from Pack");
        }
Ejemplo n.º 4
0
 public bool AddNewItem(int ID)
 {
     if (!AddCount(ID))
     {
         var newItem = new ItemsInInventory();
         newItem.ID    = ID;
         newItem.Count = 1;
         inventory.Add(newItem);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 5
0
        public void RemoveItemFromPack()
        {
            if (SelectedPackItem == null)
            {
                return;
            }

            ItemsInInventory.Add(SelectedPackItem);
            ItemsInPack.Remove(SelectedPackItem);
            CalculatePackWeight();

            Console.WriteLine("Removed Item from Pack");
        }
Ejemplo n.º 6
0
        public void AddItemToPack()
        {
            if (SelectedInventoryItem == null)
            {
                return;
            }

            ItemsInPack.Add(SelectedInventoryItem);
            ItemsInInventory.Remove(SelectedInventoryItem);
            CalculatePackWeight();

            Console.WriteLine("Added Item to Pack");
        }
Ejemplo n.º 7
0
 public void ParseFileToLoadInventory()
 {
     using (CsvReader reader = new CsvReader(new StreamReader(Filepath), true))
     {
         string[] headers = reader.GetFieldHeaders();
         while (reader.ReadNextRecord())
         {
             ItemsInInventory.Add(new PackItem {
                 ItemName = reader[0], ItemWeight = double.Parse(reader[1])
             });
         }
     }
 }
Ejemplo n.º 8
0
    void OnTriggerEnter2D(Collider2D resource)
    {
        if (resource.gameObject.tag == "NPC")
        {
            PlayerMovement.speed    = 5.0f;
            FightOutcome.wasInFight = true;
            StartCoroutine(WaitForKeyDown(KeyCode.Space, resource));
        }
        else if (resource.gameObject.tag == "FNPC")
        {
            PlayerMovement.speed       = 5.0f;
            ItemsInInventory.num_food  = ItemsInInventory.num_food + Random.Range(1, 10);
            ItemsInInventory.num_water = ItemsInInventory.num_water + Random.Range(1, 10);
            ItemsInInventory.num_wood  = ItemsInInventory.num_wood + Random.Range(1, 10);
            //Destroy(resource.gameObject);
        }
        else if (resource.gameObject.tag == "CampLife")
        {
            PlayerPrefs.SetFloat("X", 0);
            PlayerPrefs.SetFloat("Y", 0);
            PlayerPrefs.SetFloat("Z", -1);
            PlayerMovement.speed = 5.0f;
            ItemsInInventory.AddInventoryItemsToCampResource();
            SceneManager.LoadScene("T-MinusDays");
        }
        else if (resource.gameObject.tag == "Event")
        {
            //placeholder?
            EventInteraction();
        }
        else
        {
            // Item has been touched!
            if (ItemsInInventory.GetTotalItems() < max && resource.gameObject.tag != "Tree" && resource.gameObject.tag != "Lake")
            {
                // if you can still carry stuff
                Destroy(resource.gameObject);

                aud.clip = pickup_item;
                aud.Play();

                switch (resource.gameObject.tag)
                {
                case "Food":
                    ItemsInInventory.num_food++;
                    //currChara.health -= 5;
                    break;

                case "Water":
                    ItemsInInventory.num_water++;
                    //currChara.stamina -= 5;
                    break;

                case "Wood":
                    ItemsInInventory.num_wood++;
                    //currChara.strength -= 5;
                    break;
                }
            }
            else
            {
                Debug.Log("Your bag is heavy!!");
            }
        }
    }
Ejemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     itemsInInventoryScript = /*GameObject.Find("Main Camera").*/ GetComponent <ItemsInInventory>();
     //itemsInInventoryScript
     Debug.Log(GameObject.Find("Player").gameObject.transform.position.x);
 }