Search Unity

[RELEASED] Ultimate Survival - The Complete Survival Template

Discussion in 'Assets and Asset Store' started by AngryPixelUnity, Nov 20, 2016.

Thread Status:
Not open for further replies.
  1. adndima

    adndima

    Joined:
    Jun 11, 2015
    Posts:
    47
    Hello! Have you done an ability to recharge any weapon in your plugin? If so, please help me to find out ho to use it or it requires to write some additional code to solve this problem
     
  2. OZAV

    OZAV

    Joined:
    Aug 9, 2013
    Posts:
    299
    Cool !
    Will be nice when we can use GUI via Game Pads , and Xbox Controllers :)
     
    Last edited: Apr 24, 2017
  3. Flargy

    Flargy

    Joined:
    Sep 5, 2014
    Posts:
    8
    Hi guys,

    I just bought Gaia and I am trying to get it to work with Ultimate Survival.
    I followed all the steps in MessyCoders wondeful "Chopping Down Tress " turtorial
    but I can not get my terrain trees to be harvestable.
    Does anyone have a walkthrough or video to show how this can be done?

    many thanks,

    flargy
     
  4. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    You have a tutorial on this in the manual.

    Otherwise, go in the built-in "Forest" scene, Static Geometry/Terrain.
    Loot at the TreeManager script and the way it is set up. This is what you need for your Gaia terrain.

    For each tree defined on the terrain, you need an element in the "Tree Creators" list.
    Also the Prototype Index has to correspond with the tree index in the tree list:
     
    Last edited: Apr 24, 2017
  5. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    We can't do anything about that. The license allows them to do it.
    I'm impressed it got so many reviews, they posted the heavy, default version though, they could've modified the scene a little for mobiles.
     
  6. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    A few ideas to get you started:

    - Add a new property of type Integer, called "Ammo".
    - In the FPWeaponBase script you'll see I commented 2 lines: that's how to get a property and store it in a variable.
    - Make sure to mark the variable as "protected", not "private", so you have access to it in the FPHitscan script.

    After you stored your "Ammo" property like I did in the commented lines, go in the FPHitscan script and:
    - Only shoot when you have > 0 ammo.
    Syntax example:
    Code (CSharp):
    1.  
    2. if(m_Ammo.Int.Current > 0)
    3.     // Shoot...
    4.  
    - Decrease the ammo when you shoot once
    Syntax example:
    Code (CSharp):
    1.  
    2. // Store the ammo object in a variable (you can't directly modify m_Ammo.Int.Current)
    3. var ammo = m_Ammo.Int;
    4.  
    5. // Decrease the ammo.
    6. ammo.Current --;
    7.  
    8. // Set the value back in the m_Ammo property
    9. m_Ammo.SetValue(ItemProperty.Type.Int, ammo);
    10.  
    I'm thinking you have some experience with C# and Unity, if this sounds too complex, wait for v0.2 :)
     
    arnesso and TheMessyCoder like this.
  7. gegebel

    gegebel

    Joined:
    Jan 29, 2014
    Posts:
    469
    Is it normal the Hit FX are not removed ? Hierarchy gets kinda messy when you harvest for some time. pooling is not working apparently
     
  8. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    Pooling was disabled in v0.11. I'm working on v0.12 which will solve the problem, and remove the Unity 5.6-caused errors.
     
  9. gegebel

    gegebel

    Joined:
    Jan 29, 2014
    Posts:
    469
    Could the "Tree Manager" also be used with MapMagic ?
    It uses the same terrain trees as unity, just that it's all procedural.
    The only issue would be the NavMesh for the AI I guess.

    Will try out and see what happens
     
  10. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    Should work without problems.
     
  11. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    96
    This is more than helpful :) Thank you!
    I just could not find the correct form, because only tried with m_Ammo.Int.
    I am also working on some upgrade, I will let you know as it works well ;)
     
    Last edited: Apr 24, 2017
  12. gegebel

    gegebel

    Joined:
    Jan 29, 2014
    Posts:
    469
    I tested MapMagic now. It's working fine when using 1 terrain, but as soon as you use more, either procedural or fixed, the TreeManager gets confused and generates the "Empty Tree" at the wrong place.
    Terrains are only generated/displayed when you are in range, could that be one of the problems ?
     
  13. gegebel

    gegebel

    Joined:
    Jan 29, 2014
    Posts:
    469
    I tested further and I found out, the "Empty Tree" Colliders are generated at the right place, just not the right coordinates. If I put an Offset of the size of the terrain, it works.
     
  14. gegebel

    gegebel

    Joined:
    Jan 29, 2014
    Posts:
    469
    I added a line of code to "TreeManager" so I don't have to set the Offset myself on every single terrain. Works like a charm.
    Before:
    Code (CSharp):
    1. var tree = GameObject.Instantiate(m_Prefab, position + m_PositionOffset, Quaternion.Euler(m_RotationOffset), parent);
    Add:
    Code (CSharp):
    1. m_PositionOffset = new Vector3(terrain.transform.position.x, terrain.transform.position.y, terrain.transform.position.z);
     
    AngryPixelUnity likes this.
  15. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    The asset is on sale! 30% OFF!
     
    gegebel, zenGarden and TheMessyCoder like this.
  16. dreb4o

    dreb4o

    Joined:
    Mar 29, 2015
    Posts:
    51
    Where's the catch
    So many people say that this package is unique
    If this package is so good why it is sold
     
  17. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    522
    Its sold because it would be crazy to give it away for free!!!!

    30%off?? AAAAGH MADNESS!!!!
     
    arnesso likes this.
  18. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    It is easy to have only keep health and stamina bars and remove others ?
     
    Last edited: Apr 24, 2017
  19. gegebel

    gegebel

    Joined:
    Jan 29, 2014
    Posts:
    469
    yes, just disable them in the UI under HUD. Then go on Male_Player, select Player Vitals in Hierarchy, set everything in Thirst and Hunger to 0, should do the trick.
     
    TheMessyCoder and zenGarden like this.
  20. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Each buildable objects have 4 scripts, if you make a house with lot of buildable objects i am not sure this is good about performance if all buildable objects stays in the scene even with the player far away? One script only was not better ?
     
  21. jessejarvis

    jessejarvis

    Joined:
    Aug 9, 2013
    Posts:
    303
    30% Off? AAAAGH WHY DID I BUY THIS A WEEK AGO! :p

    Meh, to support the developer I guess. I love this asset.

    Edit: Support for this and ICE would be amazing. I tried but am having issues integrating death/damage.
     
  22. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    522
    Dang I love it when my own changes look similar to yours. Makes me have a bit of hope that my stuff works.
     
    arnesso likes this.
  23. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    522
    How you define that the building is Complete and doesn't require changes?
    I remember a game, can't remember which, that you would lock your building after making it. (I think romantic victor)
    You could do something like that I suppose
     
  24. gegebel

    gegebel

    Joined:
    Jan 29, 2014
    Posts:
    469
    Is there a way to define how much items you get from a recipe? Did I miss something?
    I would like planks to be craftable, recquires Log, but 1 Log/Plank is kinda lots, any way to tell the system to output more than 1 item as a result ?
     
  25. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    There isn't in 0.1, we're aware of this and implemented it in 0.2.
    If you want to code it in, let me know, I'll help.
     
  26. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    The scripts don't hurt performance if they don't have methods like Update, FixedUpdate, LateUpdate running every frame. And they don't have such methods.

    We have 4 scripts attached so we keep things modular and easy to extend upon. 3 of 4 can be attached to other entities (eg. animals). Only 1 is building system-related.

    The building system is greatly improved in v0.2, especially on the performance-side.
     
    TheMessyCoder and zenGarden like this.
  27. dreb4o

    dreb4o

    Joined:
    Mar 29, 2015
    Posts:
    51
    I still do not understand if this package is so good why it is so cheap
    All reviews say this much more than a game
     
  28. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I still does not understand why you didn't baught it yet :p
     
  29. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    The package is normally 50$, which is a fair price for an early version.
    We're raising the price with future updates.

    It is on sale (30% off) because altough for you the price might seem low, for others 15$ matter.
    The "biggest sale" period is an opportunity for any developer to sell more units and earn more revenue so why wouldn't we participate?

    But to answer your question, why is it so cheap? it is the first version (0.1), and we thought the price is perfect and will satisfy both ends. :)
     
    Adrad likes this.
  30. sebasfreelance

    sebasfreelance

    Joined:
    Aug 27, 2015
    Posts:
    240
    I hope they sell more, it is a good product, I am glad to buy it at the beginning and benefit from the free updates;) the one who buys it now, buys a bargain
     
  31. hsxtreme

    hsxtreme

    Joined:
    Apr 14, 2017
    Posts:
    55
    How to remove this mouse lock S***? Should I put this option in the settings of the player, I am beginner in C # and I am trying to some time and nothing, Always my player is locked after leaving the menu (open source pause menu)
     
    Last edited: Apr 25, 2017
  32. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    You can remove the button in the MouseLook component, which is attached to Male_Player/Look Root
     
  33. hsxtreme

    hsxtreme

    Joined:
    Apr 14, 2017
    Posts:
    55
    I already did this, there the player stays the whole time with the camera locked and the mouse loose

    My english is bad, what makes things difficult


    I'm sorry, I've already lost my patience with this function, which is of no use to me.
     
  34. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I tried the example project from the plugin, this is my feedback :
    - The Bow have weird glitch movement when we rotate keeping aiming
    - I don't like the bow gameplay, pressing left mouse button should progressively bend it , releasing mouse button should release the arrow, i don't understand why you need two mouse buttons, it complicate things.
    - I would like to see the arrows move, and there should be some pool arrow system so we could see the last ten arrows stuck arround on objects, actually it looks unrealistic to not see them fly and not see them stuck.
    - Why pistol don't do damage until a very close distance ? Is dispersion too much important ?
    -Some animal was ignoring a tree collision when walking
    - Inventory is "E" button, i didn't find how to close it ? Using "E" or "ESC" but none worked. Using the same button for open close is an intuitive way.
    - The inventory can't be opened any time, we must have something to look or interact ?
    - I would like a "Loot All" button and shortcut key that would not display the inventory but would
    gather all loot and directly place it on the inventory when there is space. It's faster gameplay when you loot common things.
    Perhaps some quick floating message saying "Rare drop" when your loot has uncommon stuff.
    - Mining rocks displays small rocks we can't gather on floor that are only a visual effect, instead player should gather rocks on floor when moving near them or using gather key "E"
    - Choping trees would need tree parets on floor we gather, it looks weird the tree simply disappear.
    - Respawning of creatures is too much fast making the demo look weird.
    - When you killed creatures, look away, and look again, the creatures are respawned with ragdoll , it looks very strange and unrealistic , hidding and respawning creatures should happen when the player is really far to not notice it.
    Perhaps it saves frame rate , but the way it is done looks too unrealistic and too noticeable.
    Perhaps wait some seconds and de activate ragdoll , and creatures can be unspawned or spawned at exact same position with exact same bones rotations.
    - I don't like a lot the spawn system, i would prefer each spawn object would have it's own list of prefabs to spawn , each with it's chance to spawn.
    A general spawn manager controlling what spawners to activate based on player distance would be a nice addition.
    - Like Zelda game, have some option to replace killed creatures by some loot objects.
    - Have water and be able to catch or hunt fish , have birds also
    - Be able to create camp fire with wood and silex, creatures will not approcah and flee camp fires.

    Another point is the demo provided is very small terrain, why not a bigger terrain with distant spwaners and creatures spread on bigger distance instead of beeing grouped closely in a non realistic way.

    Anyway this is a great and complete game template with awesome documentation and video tutorials, i hope there will be some improvments about gameplay and usability; or i'll simply do the modifications myself.
     
    Last edited: Apr 25, 2017
    hsxtreme likes this.
  35. novemtails

    novemtails

    Joined:
    Dec 13, 2016
    Posts:
    10
    I am impatient to have this asset. I have reviewed the Trello road map and have not made any changes since April 17th. I would like to know when it will be ready.
     
  36. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    522
    You can disable it like Winterbyte says, or you can make your own Escape menu.

     
    hsxtreme likes this.
  37. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    522
    You can buy the asset now, while it is on 30% off, no need to wait until version 0.2. :)
    https://www.assetstore.unity3d.com/#!/content/80368?aid=1101lMAW

    The Trello says May for 0.2, So I would assume that it will hopefully be ready before June.

    This comment was added on the forums on Saturday 22nd :)

     
    TheSeawolf likes this.
  38. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
    Thanks for the awesome asset, picked it up on sale today (been following since launch and reading the Trello board). Quick question - any chance for out of the box VR support in the future and has anyone tried to extend the system yet to support VR ( it doesn't take much to get other assets listening for VRTK interaction but there are always issues with controls that get a position for certain functionality via raycasts and mouse position)?
     
  39. hsxtreme

    hsxtreme

    Joined:
    Apr 14, 2017
    Posts:
    55


    Thank you, I have been following your videos, but my bad English has gotten me in too much trouble in many places lol
     
  40. hsxtreme

    hsxtreme

    Joined:
    Apr 14, 2017
    Posts:
    55
    How do I not lose items in respaw?
     
  41. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    Thank you for the feedback :)
    We're working on about 90% of them for v0.2, we want to make the demo scene as fluid as it can be.

    * The ragdoll bug when you look again is caused by Unity 5.6 and doesn't exist in Unity 5.5. I'm uploading a fix for it.

    Let me know if you need help, send a PM here and I'll assist you in getting what you want.

    Replace the InventoryController script with the code below, it'll add the option to keep the items on death:
    Code (CSharp):
    1. using System;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Random = UnityEngine.Random;
    5. using UltimateSurvival.Gui;
    6.  
    7. namespace UltimateSurvival
    8. {
    9.     /// <summary>
    10.     ///
    11.     /// </summary>
    12.     public class InventoryController : MonoSingleton<InventoryController>
    13.     {
    14.         /// <summary></summary>
    15.         public Value<ET.InventoryState> State = new Value<ET.InventoryState>(ET.InventoryState.Closed);
    16.  
    17.         /// <summary></summary>
    18.         public Attempt<ET.InventoryState> SetState = new Attempt<ET.InventoryState>();
    19.  
    20.         /// <summary></summary>
    21.         public Attempt<SmeltingStation> OpenFurnace = new Attempt<SmeltingStation>();
    22.  
    23.         /// <summary></summary>
    24.         public Attempt<SmeltingStation> OpenCampfire = new Attempt<SmeltingStation>();
    25.  
    26.         /// <summary></summary>
    27.         public Attempt<LootObject> OpenLootContainer = new Attempt<LootObject>();
    28.        
    29.         /// <summary></summary>
    30.         public Attempt<Anvil> OpenAnvil = new Attempt<Anvil>();
    31.  
    32.         /// <summary>This is an attempt to add a new item to the crafting queue.</summary>
    33.         public Attempt<CraftData> CraftItem = new Attempt<CraftData>();
    34.  
    35.         /// <summary></summary>
    36.         public Message<ItemHolder> EquipmentChanged = new Message<ItemHolder>();
    37.  
    38.         /// <summary>Is the inventory closed?</summary>
    39.         public bool IsClosed { get { return State.Is(ET.InventoryState.Closed); } }
    40.  
    41.         /// <summary>Stores all the item and recipe definitions.</summary>
    42.         public ItemDatabase Database { get { return m_ItemDatabase; } }
    43.  
    44.         [SerializeField]
    45.         [Tooltip("The inventory cannot function without this, as some operations, like ADD, LOAD require a database.")]
    46.         private ItemDatabase m_ItemDatabase;
    47.  
    48.         [SerializeField]
    49.         private bool m_RemoveItemsOnDeath;
    50.  
    51.         [Header("Item Collections")]
    52.  
    53.         [SerializeField]
    54.         [Range(1, 128)]
    55.         private int m_InventorySize = 24;
    56.  
    57.         [SerializeField]
    58.         [Range(1, 24)]
    59.         private int m_HotbarSize = 6;
    60.  
    61.         [SerializeField]
    62.         [Reorderable]
    63.         private ReorderableStringList m_EquipmentList;
    64.  
    65.         [Header("Item Drop")]
    66.  
    67.         [SerializeField]
    68.         private Vector3 m_DropOffset = new Vector3(0f, 0f, 0.8f);
    69.  
    70.         [SerializeField]
    71.         private float m_DropAngularFactor = 150f;
    72.  
    73.         [SerializeField]
    74.         private float m_DropSpeed = 8f;
    75.  
    76.         private PlayerEventHandler m_Player;
    77.         private ItemContainer[] m_AllCollections;
    78.         private float m_LastTimeToggledInventory;
    79.  
    80.         private List<ItemHolder> m_InventoryCollection;
    81.         private List<ItemHolder> m_HotbarCollection;
    82.         private List<ItemHolder> m_EquipmentHolders;
    83.  
    84.  
    85.         /// <summary>
    86.         /// Tries to add an amount of items in a certain collection.
    87.         /// </summary>
    88.         /// <param name="itemID"> The name of the item you want to add. </param>
    89.         /// <param name="amount"> How many items of this type you want to add?. </param>
    90.         /// <param name="collection"> Name the collection in which you want the item to be added, eg."Inventory". </param>
    91.         /// <param name="added"> This value represents the amount of items were added, if the collection was almost full, some of the items might've not been added. </param>
    92.         public bool AddItemToCollection(int itemID, int amount, string collection, out int added)
    93.         {
    94.             added = 0;
    95.  
    96.             if(!enabled)
    97.                 return false;
    98.          
    99.             for(int i = 0;i < m_AllCollections.Length;i ++)
    100.             {
    101.                 if(m_AllCollections[i].Name == collection)
    102.                 {
    103.                     // Will be true if at least one item was added.
    104.                     bool wasAdded = false;
    105.                     ItemData itemData;
    106.  
    107.                     if(m_ItemDatabase.FindItemById(itemID, out itemData))
    108.                         wasAdded = m_AllCollections[i].TryAddItem(itemData, amount, out added);
    109.  
    110.                     return wasAdded;
    111.                 }
    112.             }
    113.  
    114.             Debug.LogWarningFormat(this, "No collection with the name '{0}' was found! No item added.", collection);
    115.             return false;
    116.         }
    117.  
    118.         /// <summary>
    119.         /// Tries to add an amount of items in a certain collection.
    120.         /// </summary>
    121.         /// <param name="itemID">The id of the item you want to add.</param>
    122.         /// <param name="amount">How many items of this type you want to add?.</param>
    123.         /// <param name="collection">Name the collection in which you want the item to be added, eg."Inventory".</param>
    124.         /// <param name="added">This value represents the amount of items were added, if the collection was almost full, some of the items might've not been added.</param>
    125.         public bool AddItemToCollection(string itemName, int amount, string collection, out int added)
    126.         {
    127.             added = 0;
    128.  
    129.             if(!enabled)
    130.                 return false;
    131.  
    132.             for(int i = 0;i < m_AllCollections.Length;i ++)
    133.             {
    134.                 if(m_AllCollections[i].Name == collection)
    135.                 {
    136.                     // Will be true if at least one item was added.
    137.                     bool wasAdded = false;
    138.                     ItemData itemData;
    139.  
    140.                     if(m_ItemDatabase.FindItemByName(itemName, out itemData))
    141.                         wasAdded = m_AllCollections[i].TryAddItem(itemData, amount, out added);
    142.  
    143.                     return wasAdded;
    144.                 }
    145.             }
    146.  
    147.             Debug.LogWarningFormat(this, "No collection with the name '{0}' was found! No item added.", collection);
    148.             return false;
    149.         }
    150.  
    151.         public int GetItemCount(string name)
    152.         {
    153.             // TODO: We shouldn't have access to GUI functions here.
    154.             return GUIController.Instance.GetContainer("Inventory").GetItemCount(name);
    155.         }
    156.  
    157.         /// <summary>
    158.         /// Removes the item if it exists in the inventory, if not, the method will return false.
    159.         /// </summary>
    160.         public bool TryRemoveItem(SavableItem item)
    161.         {
    162.             if(!enabled)
    163.                 return false;
    164.          
    165.             for(int i = 0;i < m_AllCollections.Length;i ++)
    166.             {
    167.                 bool removed = m_AllCollections[i].TryRemoveItem(item);
    168.                 if(removed)
    169.                     return true;
    170.             }
    171.  
    172.             return false;
    173.         }
    174.  
    175.         public void RemoveItems(string itemName, int amount = 1)
    176.         {
    177.             // TODO: We shouldn't have access to GUI functions here.
    178.             var inventory = GUIController.Instance.GetContainer("Inventory");
    179.             inventory.RemoveItems(itemName, amount);
    180.         }
    181.  
    182.         public bool Try_DropItem(SavableItem item, Slot parentSlot = null)
    183.         {
    184.             if(item && item.ItemData.WorldObject && !item.ItemData.IsBuildable)
    185.             {
    186.                 var cameraTransform = GameController.WorldCamera.transform;
    187.                 GameObject droppedItem = Instantiate(item.ItemData.WorldObject, cameraTransform.position + cameraTransform.TransformVector(m_DropOffset), Random.rotation) as GameObject;
    188.  
    189.                 var rigidbody = droppedItem.GetComponent<Rigidbody>();
    190.                 if(rigidbody)
    191.                 {
    192.                     rigidbody.angularVelocity = Random.rotation.eulerAngles * m_DropAngularFactor;
    193.                     rigidbody.AddForce(cameraTransform.forward * m_DropSpeed, ForceMode.VelocityChange);
    194.  
    195.                     Physics.IgnoreCollision(m_Player.GetComponent<Collider>(), droppedItem.GetComponent<Collider>());
    196.                 }
    197.  
    198.                 var pickup = droppedItem.GetComponent<ItemPickup>();
    199.                 if(pickup)
    200.                     pickup.ItemToAdd = item;
    201.  
    202.                 if(parentSlot)
    203.                     parentSlot.ItemHolder.SetItem(null);
    204.  
    205.                 return true;
    206.             }
    207.  
    208.             return false;
    209.         }
    210.  
    211.         public List<ItemHolder> GetEquipmentHolders()
    212.         {
    213.             return m_EquipmentHolders;
    214.         }
    215.  
    216.         private void Awake()
    217.         {
    218.             if(!m_ItemDatabase)
    219.             {
    220.                 Debug.LogError("No ItemDatabase specified, the inventory will be disabled!", this);
    221.                 enabled = false;
    222.                 return;
    223.             }
    224.  
    225.             SetState.SetTryer(TryChange_State);
    226.  
    227.             // TODO: We shouldn't have access to GUI functions here.
    228.             m_AllCollections = GUIController.Instance.Containers;
    229.  
    230.             // Create the inventory.
    231.             // TODO: We shouldn't have access to GUI functions here.
    232.             m_InventoryCollection = CreateListOfHolders(m_InventorySize);
    233.             var inventoryCollection = GUIController.Instance.GetContainer("Inventory");
    234.             inventoryCollection.Setup(m_InventoryCollection);
    235.  
    236.             // Create the hotbar.
    237.             // TODO: We shouldn't have access to GUI functions here.
    238.             m_HotbarCollection = CreateListOfHolders(m_HotbarSize);
    239.             var hotbarCollection = GUIController.Instance.GetContainer("Hotbar");
    240.             hotbarCollection.Setup(m_HotbarCollection);
    241.  
    242.             // Create the equipment.
    243.             // TODO: We shouldn't have access to GUI functions here.
    244.             m_EquipmentHolders = CreateListOfHolders(m_EquipmentList.Count);
    245.             for(int i = 0;i < m_EquipmentList.Count;i ++)
    246.             {
    247.                 var equipmentGUI = GUIController.Instance.GetContainer(m_EquipmentList[i]);
    248.                 if(equipmentGUI)
    249.                     equipmentGUI.Setup(new List<ItemHolder>() { m_EquipmentHolders[i] });
    250.                 else
    251.                     Debug.LogErrorFormat(this, "No GUI collection with the name '{0}' was found!", m_EquipmentList[i]);
    252.             }
    253.  
    254.             m_Player = GameController.LocalPlayer;
    255.             m_Player.ChangeHealth.AddListener(OnChanged_PlayerHealth);
    256.             m_Player.Death.AddListener(On_PlayerDeath);
    257.         }
    258.  
    259.         private void OnChanged_PlayerHealth(HealthEventData data)
    260.         {
    261.             if(data.Delta < 0f)
    262.                 for(int i = 0; i < m_EquipmentHolders.Count; i ++)
    263.                 {
    264.                     if(m_EquipmentHolders[i].HasItem && m_EquipmentHolders[i].CurrentItem.HasProperty("Durability"))
    265.                     {
    266.                         var durabilityProp = m_EquipmentHolders[i].CurrentItem.GetPropertyValue("Durability");
    267.                         var floatVal = durabilityProp.Float;
    268.                         floatVal.Current --;
    269.  
    270.                         durabilityProp.SetValue(ItemProperty.Type.Float, floatVal);
    271.  
    272.                         if(floatVal.Current <= 0f)
    273.                             m_EquipmentHolders[i].SetItem(null);
    274.                     }
    275.                 }
    276.         }
    277.  
    278.         private void On_PlayerDeath()
    279.         {
    280.             if(State.Get() != ET.InventoryState.Closed)
    281.                 SetState.Try(ET.InventoryState.Closed);
    282.  
    283.             if(m_RemoveItemsOnDeath)
    284.             {
    285.                 RemoveItemsFromCollection("Inventory");
    286.                 RemoveItemsFromCollection("Hotbar");
    287.  
    288.                 foreach(var col in m_EquipmentList)
    289.                     RemoveItemsFromCollection(col);
    290.             }
    291.         }
    292.  
    293.         private void RemoveItemsFromCollection(string collection)
    294.         {
    295.             // TODO: We shouldn't have access to GUI functions here.
    296.             var wrapper = GUIController.Instance.GetContainer(collection);
    297.  
    298.             if(!wrapper)
    299.                 return;
    300.  
    301.             foreach(var slot in wrapper.Slots)
    302.             {
    303.                 if(slot.HasItem)
    304.                     slot.ItemHolder.SetItem(null);
    305.             }
    306.         }
    307.  
    308.         private void DropItemsFromCollection(string collection)
    309.         {
    310.             var container = GUIController.Instance.GetContainer(collection);
    311.  
    312.             if(!container)
    313.                 return;
    314.  
    315.             foreach(var slot in container.Slots)
    316.             {
    317.                 if(slot.HasItem)
    318.                 {
    319.                     if(slot.CurrentItem.ItemData.IsBuildable)
    320.                         slot.ItemHolder.SetItem(null);
    321.                     else
    322.                         Try_DropItem(slot.CurrentItem, slot);
    323.                 }
    324.             }
    325.         }
    326.  
    327.         private bool TryChange_State(ET.InventoryState state)
    328.         {
    329.             bool stateWasChanged = false;
    330.  
    331.             if(Time.time > m_LastTimeToggledInventory + 0.5f)
    332.             {
    333.                 m_LastTimeToggledInventory = Time.time;
    334.                 stateWasChanged = true;
    335.             }
    336.              
    337.             if(stateWasChanged)
    338.             {
    339.                 State.Set(state);
    340.                 UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(null);
    341.             }
    342.  
    343.             return stateWasChanged;
    344.         }
    345.  
    346.         private List<ItemHolder> CreateListOfHolders(int size)
    347.         {
    348.             var slots = new List<ItemHolder>();
    349.  
    350.             for(int i = 0;i < size;i ++)
    351.                 slots.Add(new ItemHolder());
    352.  
    353.             return slots;
    354.         }
    355.     }
    356. }
    357.  
     
    zenGarden likes this.
  42. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    Thank you :)
    There is a chance, but after we're done with v0.3, we don't own any VR equipment at the moment but we're eager to try it in a few months.
     
    Tethys likes this.
  43. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    Will be ready in May, don't worry about Trello, you'll see a wave of ticks coming soon :p
     
    gegebel and Tethys like this.
  44. franky_li

    franky_li

    Joined:
    Aug 8, 2016
    Posts:
    163
    Just purchased this great asset and added it to my project. Works so far like a charm, but I've got some questions.
    1. How can I start with items in the slots, but no item in the hands of the player?
    2. Is there a way to set a start item from the slots? At the moment the player always uses slot 0.
    3. The 'Breathing Heavy' sound is not played, while all other sounds work fine.
    4. Is there a way to route the footstep sounds to the audio mixer?
    5. How can I remove an item, so that the player has empty hands again? Is it possible to use the slots as a kind of toggle, e.g. player has empty hands, I select a item from a slot, use it, then select the same slot again to put it back. Or is there already an other key for that?
     
  45. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    96
    Hm ,i have just noticed the similarity between Subsistence game and US asset :) What is the connection ?
    One of the developers is making this game ?
     
  46. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    No, no connection :p
     
  47. novemtails

    novemtails

    Joined:
    Dec 13, 2016
    Posts:
    10
    Thanks, I'll be on the way.
     
  48. AngryPixelUnity

    AngryPixelUnity

    Joined:
    Oct 25, 2016
    Posts:
    816
    Thank you for purchasing!

    1.You can set the starting items at Male_Player/Inventory Controller --> InventoryController script.

    2.You can't set items in a specific slot through the inspector, but it can easily be done in code. Let me know if you need help with the code.

    3.I'm not sure why it isn't working for you, will take another look for v0.2.

    4.The footsteps player script creates 2 audio sources at runtime, one for each foot, under the player,
    you can assign the desired mixer through code. Again if you need help or you can't code at all, let me know, I'll do it through Team Viewer.

    5.This is a very handy feature which will be present in v0.2.
     
  49. tequyla

    tequyla

    Joined:
    Jul 22, 2012
    Posts:
    335
    hi Sir,

    is possible to add garbage for deleting clone objects or find a way because I have fired lot of times with a gun (bullets) and many clones stay in game.

    i guess same thing for arrow.

    +++
     

    Attached Files:

  50. jesseganey

    jesseganey

    Joined:
    Apr 26, 2017
    Posts:
    78
    Great asset possibly the best ive seen. Just bought it the day before it went on sell but do not regret it. Well worth the $50. Cant wait to see the next update. Thanks for all the hard work.
     
    AngryPixelUnity likes this.
Thread Status:
Not open for further replies.