Search Unity

Controller Third Person Templates by Invector

Discussion in 'Tools In Progress' started by Invector, Aug 20, 2015.

  1. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Oh yeah! Forgot about that script.
     
  2. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    V-bot 2.0 Combat Army Skin

    Comming Soon!


     
    jgiroux, jcarrick, Malbers and 5 others like this.
  3. macodys

    macodys

    Joined:
    Jul 22, 2012
    Posts:
    64
    WOW! Looks awesome!
     
  4. jgiroux

    jgiroux

    Joined:
    Jul 21, 2015
    Posts:
    22
    I have been writing a add-on script that adds the following:

    Experience (with experience progression table and custom XPGained GUI text on enemy death
    Level (with sound on level up/VFX on level up/Custom GUI text on level up and XP bar graphic (i.e. health and stamina bar)
    Hunger
    Thirst
    Breath
    BodyTemp

    its a simple plug and play after setting up a few inspector values, if anyone is interested I could post here
    simply add one script to your player and another onto any enemy. although you do have to make one change in the Vcharacter controller script to change the current stamina value from private to public, but its very easy.

    at the very least it might help people trying to implement their own elements into Invector without having to mess with invector code itself/ which can be a timesink when invector updates come out and you have to edit things all over again.


    @Invector team.

    would it be at all possible on the next update to get the CurrentStamina variable made public for script-addon templates like the one Id like to create, I know I can do it myself, but was wondering if there was a particular reason that is the only one that's private? when health and such are public? otherwise I would have to make any user of my add-on scripts have to edit the code manually, which isn't hard by any stretch of the imagination , but if it could be as easy as dragging a add-on script to bridge between your components and custom ones, well that would be ideal!

    cant say enough how much of a gem this asset is.
     
    Invector likes this.
  5. duniatorga

    duniatorga

    Joined:
    Mar 11, 2016
    Posts:
    21
    Thank You Could Already, But Can not Set Her feet lowered? untitled.PNG
     
  6. bluray467

    bluray467

    Joined:
    May 28, 2015
    Posts:
    15
    do i have to attach it to the player or to the enemy?
     
  7. bluray467

    bluray467

    Joined:
    May 28, 2015
    Posts:
    15
    I attached it to the 3rd person controller, and i did everything but when i defeat the boss nothing happens.
     
  8. Prefab

    Prefab

    Joined:
    May 14, 2013
    Posts:
    68
    Hi, is it possible to choose which hand weapons are equipped in when picking them up? Eg. press "f" to pick up and equip weapon in left hand, press "g" to pick up and equip weapon in right hand? So if the player finds a knife they can choose which hand to equip it in (left or right), if they then find another knife they can choose to either replace their current one or equip it in the other hand and dual wield.

    Also how are the animation states setup for the different weapons, is it one state for each weapon, or one state for each combination of weapons? For example, if I have a shield and a sword and both weapons can be equipped in either the left hand or the right hand, will I need 4 animation states (shield left, shield right, sword left, sword right) or will I need an animation state for each possible combination of these weapons (shield left, shield right, shield both, shield left sword right, sword left shield right, sword left, sword right, sword both).
     
  9. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Awesome @jgiroux :D - I already change to public for the next update!

    On the NavMesh Agent component, change the Base Offset, you may need to adjust the capsule collider height too.

    If you want to change the scene when your boss dies, then you need to attach into your boss :)

    On the ThirdPersonController script, there is the method PickUpMeleeWeaponInput and DropWeaponInput, you can customize to your need, change inputs and stuff.

    The vMeleeManager will always get the MoveSet_ID of the attack weapon (right hand), but I think you can make some different combinations using the layers too.
     
  10. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    It monitors the current health of whatever it is attached to so you need to attach it to the boss, not the player. And use the edited version from Invector.
     
  11. bluray467

    bluray467

    Joined:
    May 28, 2015
    Posts:
    15
    https://gyazo.com/9a25e1561337de85a22dd3dd30d120d1
    how do i fix this?
     
  12. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    118
    Hey @Invector
    could you make me happy and put that in the next update of the file vThirdPersonController :

    Code (CSharp):
    1.        
    2.          void Start()
    3.         {
    4.             Init();                         // setup the basic information, created on Character.cs  
    5.             #if !UNITY_EDITOR
    6.                 Cursor.visible = false;
    7.             #endif
    8.         }  
    Thanks :D
     
    Invector likes this.
  13. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    LOL! I forgot to call the co-routine and Invector forgot the semicolon at the end and to check the value of current health. Replace it with this:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Invector;
    4. using UnityEngine.SceneManagement;
    5.  
    6.  
    7. public class BossFight : MonoBehaviour
    8. {
    9.     public vCharacter iChar;
    10.     public string SceneName;
    11.     public float waittime = 1;
    12.  
    13.     // Use this for initialization
    14.     void Start()
    15.     {
    16.         iChar = GetComponent<vCharacter>();
    17.     }
    18.  
    19.     // Update is called once per frame
    20.     void Update()
    21.     {
    22.         if (iChar.currentHealth<=0)
    23.         {
    24.             StartCoroutine(ChangeScene(waittime));
    25.             }
    26.     }
    27.     IEnumerator ChangeScene(float waitTime)
    28.     {
    29.         yield return new WaitForSeconds(waittime);
    30.         SceneManager.LoadScene(SceneName);
    31.         // Application.LoadLevel(SceneName);
    32.     }
    33. }
     
    Invector likes this.
  14. PIGame

    PIGame

    Joined:
    May 2, 2016
    Posts:
    32
    Have anyone tried to make the pause game feature? How would you do it? I'm stucking at freezing the player and the enemies are beating the sh!tt out of him lol
     
  15. bluray467

    bluray467

    Joined:
    May 28, 2015
    Posts:
    15
    you guys are the best.
    thanks a lot.
     
    Invector and drewradley like this.
  16. jgiroux

    jgiroux

    Joined:
    Jul 21, 2015
    Posts:
    22
    code last edited/updated 6/27/2016 5pm EST to add more features

    here is a quick youtube video to show setup and GUI HUD creation






    A "Experience/Leveling/Hunger/Thirst/Rest/BodyTemp/Breath" Add-On for Invector3rdPerson Template;

    as promised here is the code. should work out of box in next update but for versions below "c" you will need to make one small edit//open your vCharacter.cs script from Invector3rdPersonController->Scripts->CharacterController folder.
    once open navigate to
    #region Character Variables
    within there
    change
    protected float currentStamina; to public float currentStamina.
    compile.
    Then create the two following scripts. remember to do the above first before creating the scripts.

    create a new c# script and call it - InvectorAddOn -
    open it and erase everything inside then copy/paste code and save/build

    Code (CSharp):
    1. using UnityEngine;
    2. using Invector.CharacterController;
    3. using Invector;
    4. using System.Text;
    5. using System;
    6. using UnityEngine.UI;
    7. using System.Collections.Generic;
    8. using System.Collections;
    9.  
    10. public class InvectorAddOn : MonoBehaviour {
    11.  
    12.     #region Invector Bridge
    13.     [System.Serializable]
    14.     public class Vinvectorbridge
    15.     {
    16.         [Tooltip("Drag Player with Invector V3rdPersonController Component to here")]
    17.         public vThirdPersonController myController;
    18.         [Tooltip("Drag Prefab 'audiosource' from Assets->Invector-3rd personController->scripts->Footstep->audiosource folder to here")]
    19.         public GameObject audioSource;
    20.     }
    21.        [Header("______ INVECTOR BRIDGE ___________________________")]
    22.     public Vinvectorbridge InvectorBridge;
    23.     #endregion
    24.  
    25.     #region Invector Stats
    26.     [System.Serializable]
    27.     public class VinvectorbridgeStats
    28.     {
    29.         [Tooltip("Invector current health from Invector 3rdPerson Component")]
    30.         public float Vcurrent_health; // get health from inector 3rdperson controller
    31.         [Tooltip("Invector current stamina from Invector 3rdPerson Component")]
    32.         public float Vcurrent_stamina; // get stamina from invector 3rdperson controller
    33.         [Tooltip("Invector current max health from Invector 3rdPerson Component")]
    34.         public float VMaxhealth;  // get max health from invector 3rdperson controller
    35.         [Tooltip("Invector current max stamina from Invector 3rdPerson Component")]
    36.         public float VMaxstamina;  // get max stamina from invector 3rdperson controller
    37.         [System.Serializable]
    38.         public class VinvectorbridgeStatsHSR
    39.         {
    40.             [Tooltip("Invector current health recovery from Invector 3rdPerson Component")]
    41.             public float VhealthRecovery; // get health recovery from invector 3rdperson controller
    42.             [Tooltip("Invector current health recovery delay from Invector 3rdPerson Component")]
    43.             public float VhealthRecoveryDelay; // get health recovery delay from invector 3rdperson controller
    44.             [Tooltip("Invector current stamina recovery from Invector 3rdPerson Component")]
    45.             public float VstaminaRecovery; // get stamina recovery from invector 3rdperson controller
    46.         }
    47.         [Tooltip("Invector Recovery Stats")]
    48.         public VinvectorbridgeStatsHSR RecoveryStats;
    49.     }
    50.        [Header("______ INVECTOR STATS ___________________________")]
    51.        [Tooltip("Invector Stats, these will be populated at runtime from invector 3rdperson component")]
    52.     public VinvectorbridgeStats InvectorStats;
    53.     #endregion
    54.  
    55.  
    56.     [System.Serializable]
    57.     public class PlayerLevelStats
    58.     {
    59.    
    60.         [Space(10)]
    61.         [Tooltip("players current level")]
    62.         public int PlayersLevel; // current level of player
    63.         [Space(10)]
    64.         [Header("____________________PLAYER EXPERIENCE ________________________")]
    65.         [Tooltip("players current xp gain")]
    66.         public float PlayerCurrentXP; // current XP of player
    67.         [Tooltip("a running value of the total XP gained over history of players levels")]
    68.         public float PlayerLifetimeXP; // a running value of the total XP gained over history of players levels
    69.         [Tooltip("next amount of XP needed to gain a new level")]
    70.         public float current_xp_to_nxt_Level; // next amount of XP needed to gain a new level
    71.         [Tooltip("the maximum level a player can attain")]
    72.         public int m_maximumLevel = 100; // maximum level
    73.    
    74.  
    75.  
    76.         [Header("____________________LEVEL PROGRESSION _________________________")]
    77.         /// The list of scores required to advance to the next level. these can be changed in the inspector
    78.         [Tooltip("Create a series of increasing XP for each level increase")]
    79.         public int[] m_nextLevelScore = { 0, 3000, 7000, 12000, 18000, 25000, 34000,
    80.         44000, 56000, 69000, 80000 };
    81.         /// The number of required points to score to advance to the next level once
    82.         //the score has gone beyond the provided list of points. this can be changed in Inspector
    83.         public int m_nextLevelScoreProgression = 100000;
    84.    
    85.  
    86.    
    87.         [System.Serializable]
    88.         public class MyLevelUpFeatures
    89.         {
    90.             [Header("____________________LEVEL UP MULTIPLIER_________________")]
    91.             [Tooltip("a integer to multiply by players level to get new health bonus on level up")]
    92.             [Space(10)]
    93.             public int VHealthMultiplier;
    94.             [Tooltip("a integer to multiply by players level to get new stamina bonus on level up")]
    95.             public int VStaminaMultiplier;
    96.             [Space(10)]
    97.             [Header("____________________SOUND FX_______________________")]
    98.             [Tooltip("Play a sound on Level up, leave empty if you dont want a sound played")]
    99.             public AudioClip m_LevelUpSound;
    100.             [Space(10)]
    101.             [Tooltip("Play a VFX particle on Level up, leave empty if you dont want a VFX particle played")]
    102.             [Header("____________________PARTICLE VFX and POSITION___________________")]
    103.             public GameObject LevelUpVFX;
    104.             [Tooltip("the offset of the above VFX spawnpoint")]
    105.             public Vector3 LevelUpVFXOffset = new Vector3(0.5f, 0.5f, 0.5f);
    106.        
    107.  
    108.         }
    109.         [Tooltip("Here you can adjust several features of leveling up")]
    110.         public MyLevelUpFeatures LevelUpFeatures;
    111.    
    112.  
    113.         [System.Serializable]
    114.         public class UI_LevelElements
    115.         {
    116.             [Header("____________________UI SPLASH TEXT_______________________")]
    117.             [Tooltip("a UItext that will display on Level Up example:'you have gained a new level!!!', create a new UItext as assign here, leave blank if you do not want to use this feature")]
    118.             public Text UI_MyLevelUpSplashText;
    119.             [Tooltip("Time for splash text on level up to stay on screen before fade")]
    120.             public float SplashTexttime = 10; // change how log splash level up text is displayed on screen/ higher number = longer screen time.
    121.             [Header("____________________UI XP GAINED TEXT_______________________")]
    122.             [Tooltip("a UItext that will display on enemy death example:'you have gained 200XP', create a new UItext and assign here, leave blank if you do not want to use this feature")]
    123.             public Text UI_XPGainedSplashText;
    124.             [Tooltip("Time for XP gained splash text to stay on screen before fade")]
    125.             public float XPGainedSplashTextTime = 5; // change how log splash level up text is displayed on screen/ higher number = longer screen time.
    126.             [Header("____________________UI PLAYER CURRENT LEVEL TEXT_______________________")]
    127.             [Tooltip("a UItext that will display the players current level, create a new UItext and assign here, leave blank if you do not want to use this feature")]
    128.             public Text UI_MyLevelNumber;
    129.             [Header("____________________UI XP BAR FILL GRAPHIC_______________________")]
    130.             [Tooltip("a UIImage set to type [FILL] and dragged here to display a Current/Max XP HUD")]
    131.             public Image UI_XPFillImage;
    132.             [Header("____________________UI CUSTOM IMAGE_______________________")]
    133.             [Tooltip("a UIImage that will fade in and out upon level up, create a new UIImage and assign here, leave blank if you do not want to use this feature")]
    134.             public Image levelUpScreenOverlay;
    135.             [Tooltip("How long will above UIImage take to fade in/fade out")]
    136.             public float levelUpScreenOverlayTime = 4f;
    137.         }
    138.         [Tooltip("Here you can adjust several UI features of leveling up")]
    139.         public UI_LevelElements LevelUpUIElements;
    140.     }
    141.         [Tooltip("Player level system and features")]
    142.         [Header("______ PLAYER LEVELING SYSTEM _____________________")]
    143.  
    144.     public PlayerLevelStats PlayerLevel;
    145.  
    146.     #region Hunger Thirst System
    147.     [System.Serializable]
    148.     public class Hungerthirstsystem
    149.     {
    150.         #region hunger
    151.         [Header("--Hunger--")]
    152.         [Tooltip("enable hunger? yes is checked/ no is unchecked")]
    153.         public bool UseHunger;
    154.         public float CurrentHunger;
    155.         public float MaxHunger = 100;
    156.         [Tooltip("a integer to multiply by players level to get new health bonus on level up")]
    157.         public int HungerMultiplier = 15;
    158.         [Tooltip("a float value that determines how fast your hunger increases")]
    159.         public float HungerModifier = .1f;
    160.         [Tooltip("a UIImage set to type [FILL] and dragged here to display a Current/Max HUD")]
    161.         public Image UI_HungerFillImage;
    162.         [Tooltip("a UIImage that will fade in and out at critical threshold")]
    163.         public Image UI_HungerScreenOverlay;
    164.         [Tooltip("How long will above UIImage take to fade in/fade out")]
    165.         public float UI_HungerScreenOverlayTime = 4f;
    166.         [Tooltip("Play a sound at critical threshold, leave empty if you dont want a sound played")]
    167.         public AudioClip HungerCriticalSound;
    168.         #endregion
    169.  
    170.         #region thirst
    171.         [Header("--Thirst--")]
    172.         [Tooltip("enable thirst? yes is checked/ no is unchecked")]
    173.         public bool UseThirst;
    174.         public float CurrentThirst;
    175.         public float MaxThirst = 100;
    176.         [Tooltip("a integer to multiply by players level to get new health bonus on level up")]
    177.         public int ThirstMultiplier = 15;
    178.         [Tooltip("a float value that determines how fast your thirst increases")]
    179.         public float ThirstModifier = .3f;
    180.         [Tooltip("a UIImage set to type [FILL] and dragged here to display a Current/Max HUD")]
    181.         public Image UI_ThirstFillImage;
    182.         [Tooltip("a UIImage that will fade in and out at critical levels")]
    183.         public Image UI_ThirstScreenOverlay;
    184.         [Tooltip("How long will above UIImage take to fade in/fade out")]
    185.         public float UI_ThirstScreenOverlayTime = 4f;
    186.         [Tooltip("Play a sound at critical threshold, leave empty if you dont want a sound played")]
    187.         public AudioClip ThirstCriticalSound;
    188.         #endregion
    189.  
    190.         #region rest
    191.         [Header("--Rest--")]
    192.         [Tooltip("enable rest? yes is checked/ no is unchecked")]
    193.         public bool UseRest;
    194.         public float CurrentRest;
    195.         public float MaxRest = 100;
    196.         [Tooltip("a integer to multiply by players level to get new health bonus on level up")]
    197.         public int RestMultiplier = 15;
    198.         [Tooltip("a float value that determines how fast your rest/tiredness increases")]
    199.         public float RestModifier = .05f;
    200.         [Tooltip("a UIImage set to type [FILL] and dragged here to display a Current/Max HUD")]
    201.         public Image UI_RestFillImage;
    202.         [Tooltip("a UIImage that will fade in and out at critical levels")]
    203.         public Image UI_RestScreenOverlay;
    204.         [Tooltip("How long will above UIImage take to fade in/fade out")]
    205.         public float UI_RestScreenOverlayTime = 4f;
    206.         [Tooltip("Play a sound at critical threshold, leave empty if you dont want a sound played")]
    207.         public AudioClip RestCriticalSound;
    208.         #endregion
    209.  
    210.         #region bodytemp
    211.         [Header("--BodyTemp--")]
    212.         [Tooltip("enable body temperature? yes is checked/ no is unchecked")]
    213.         public bool UseBodyTemp;
    214.         public float CurrentBodyTemp = 98.5f;
    215.         public float MaxBodyTemp = 200.5f;
    216.         public float NormalBodyTemp = 98.5f;
    217.         [Tooltip("a integer to multiply by players level to get new health bonus on level up")]
    218.         public int BodyTempMutiplier;
    219.         [Tooltip("a float value that determines how fast your body temp increases/decreases")]
    220.         public float BodyTempModifier = .1f;
    221.         [Tooltip("a UIImage set to type [FILL] and dragged here to display a Current/Max HUD")]
    222.         public Image UI_BodyTempFillImage;
    223.         [Tooltip("a bool to trigger body temp dropping/ includes options for custom fade in overlay texture - fade out overlay texture")]
    224.         public bool isGettingCold = false;
    225.         public bool isGettingHot = false;
    226.         [Tooltip("a UIImage that will fade in and out at critical levels")]
    227.         public Image UI_FrozenScreenOverlay;
    228.         [Tooltip("a UIImage that will fade in and out at critical levels")]
    229.         public Image UI_HeatedScreenOverlay;
    230.         [Tooltip("Play a sound at critical threshold, leave empty if you dont want a sound played")]
    231.         public AudioClip FrozenCriticalSound;
    232.         [Tooltip("Play a sound at critical threshold, leave empty if you dont want a sound played")]
    233.         public AudioClip HeatedCriticalSound;
    234.         #endregion
    235.  
    236.         #region breath
    237.         [Header("--Breath--")]
    238.         [Tooltip("enable holding breath? yes is checked/ no is unchecked")]
    239.         public bool UseBreath;
    240.         public float CurrentBreath;
    241.         public float MaxBreath = 10;
    242.         [Tooltip("a integer to multiply by players level to get new health bonus on level up")]
    243.         public int BreathMutiplier = 15;
    244.         [Tooltip("a float value that determines how fast your lack of oxygen increases")]
    245.         public float BreathModifier = 1.5f;
    246.         [Tooltip("a UIImage set to type [FILL] and dragged here to display a Current/Max HUD")]
    247.         public Image UI_BreathFillImage;
    248.         [Tooltip("a bool to trigger if player is holding breath, if ON holding breath values will increase to max / if OFF will decrease to zero")]
    249.         public bool isHoldingBreath = false;
    250.         [Tooltip("a UIImage that will fade in and out at critical levels")]
    251.         public Image UI_OutOfBreathOverlay;
    252.         [Tooltip("Play a sound at critical threshold, leave empty if you dont want a sound played")]
    253.         public AudioClip OutOfBreathCriticalSound;
    254.         #endregion
    255.     }
    256.     [Header("______ HUNGER/THIRST SYSTEM _____________________")]
    257.         [Tooltip("Here you can enable/disable and set certain features of a generic hunger/thirst system")]
    258.     public Hungerthirstsystem HungerThirstElements;
    259.     #endregion
    260.  
    261.     #region Attribute System
    262.     [System.Serializable]
    263.     public class AttributePlayer
    264.     {
    265.         #region mana
    266.         [Header("--MANA--")]
    267.         [Tooltip("enable Mana use? checked = Yes, unchecked = NO")]
    268.         public bool UseMana;
    269.         public float CurrentMana;
    270.         public float MaxMana = 100;
    271.         [Tooltip("a integer to multiply by players level to get new health bonus on level up")]
    272.         public int ManaMultiplier = 15;
    273.         [Tooltip("a float value that determines how fast your mana increases")]
    274.         public float ManaRegenModifier = 5;
    275.         [Tooltip("a float value that determines how fast your mana decreases")]
    276.         public float ManaCastingModifier = 25f;
    277.         [Tooltip("a UIImage set to type [FILL] and dragged here to display a Current/Max Mana HUD, leave blank if you do not want to use this feature")]
    278.         public Image UI_ManaFillImage;
    279.         [Tooltip("are we casting a spell? Checked = Yes, unchecked = NO")]
    280.         public bool IsSpellCasting;
    281.         #endregion
    282.  
    283.         #region strength
    284.         [Header("--STRENGTH--")]
    285.         [Tooltip("enable Strength use? checked = Yes, unchecked = NO")]
    286.         public bool UseStrength;
    287.         public int CurrentStrength;
    288.         public int MaxStrength = 18;
    289.         [Tooltip("a integer to multiply by players level to get new health bonus on level up")]
    290.         public int StrengthMultiplier = 15;
    291.         [Tooltip("a float value that determines how fast your hunger increases")]
    292.         public float StrengthModifier = .1f;
    293.         [Tooltip("a UIImage set to type [FILL] and dragged here to display a Current/Max Strength HUD, leave blank if you do not want to use this feature")]
    294.         public Image UI_StrengthFillImage;
    295.         #endregion
    296.  
    297.     }
    298.     [Header("______ ATTRIBUTE SYSTEM _____________________")]
    299.     [Tooltip("Here you can enable/disable and set certain attributes of a generic character system")]
    300.     public AttributePlayer PlayerAttibutes;
    301.     #endregion
    302.  
    303.     #region Extras
    304.     [System.Serializable]
    305.     public class extras
    306.     {
    307.         #region Play Time
    308.         [System.Serializable]
    309.         public class PlayersTime
    310.         {
    311.             [Tooltip("enable amount if time played? checked = YES, unchecked = NO")]
    312.             public bool EnablePlaytime;
    313.             [HideInInspector]
    314.             public int playtime = 0;
    315.             public int seconds = 0;
    316.             public int minutes = 0;
    317.             public int hours = 0;
    318.             public int days = 0;
    319.             [Tooltip("a UItext to display current day/hour/minute/second HUD of playtime, leave blank if you do not want to use this feature")]
    320.             public Text PlaytimeUIText;
    321.  
    322.         }
    323.         [Header("______ PLAYTIME _____________________")]
    324.         [Tooltip("Here you can enable/disable overall playtime of character system")]
    325.         public PlayersTime Playtime;
    326.         #endregion
    327.  
    328.         #region Armor System
    329.         [System.Serializable]
    330.         public class ArmorCSystem
    331.         {
    332.             public GameObject currentWeaponinRightHand;
    333.             public GameObject currentWeaponinLeftHand;
    334.             public GameObject currentArmorChest;
    335.             public GameObject currentArmorHead;
    336.             public GameObject currentArmorLHand;
    337.             public GameObject currentArmorRHand;
    338.             public GameObject currentArmorLWrist;
    339.             public GameObject currentArmorRWrist;
    340.             public GameObject currentArmorBelt;
    341.             public GameObject currentArmorBack;
    342.             public GameObject currentArmorShoulders;
    343.             public GameObject currentArmorShirt;
    344.             public GameObject currentArmorLegs;
    345.             public GameObject currentArmorFeet;
    346.             public GameObject currentRightHandRing;
    347.             public GameObject currentLeftHandRing;
    348.         }
    349.         [Header("______ ARMOR SYSTEM _____________________")]
    350.         [Tooltip("Here you can enable/disable and set certain features of a generic armor system - currently in development")]
    351.         public ArmorCSystem ArmorSystem;
    352.         #endregion
    353.  
    354.         #region CheatCodes
    355.         [System.Serializable]
    356.         public class Cheaters
    357.         {
    358.             [Tooltip("enable godmode? checked = YES, unchecked = NO : in godmode your health and stamina are set to 99999")]
    359.             public bool GodMode;
    360.             [HideInInspector]
    361.             public float OldCurrentHealth; // get old value of health
    362.             [HideInInspector]
    363.             public float OldCurrentStamina; // get old value of stamina
    364.             [HideInInspector]
    365.             public float OldCurrentMaxHealth; // get old value of max health
    366.             [HideInInspector]
    367.             public float OldCurrentMaxStamina; // get old value of max stamina
    368.  
    369.         }
    370.         [Header("______ CHEATCODES _____________________")]
    371.         [Tooltip("Here you can enable/disable cheatcodes of character system")]
    372.         public Cheaters Cheatcodes;
    373.         #endregion
    374.  
    375.         #region Current Objects Stats
    376.         [System.Serializable]
    377.         public class CurrSystem
    378.         {
    379.             public bool UseCurrentSystem;
    380.             public GameObject currentEnemy;
    381.             public float currentDamageGiven;
    382.             public float currentDamageReceived;
    383.         }
    384.         [Header("______ CURRENT OBJECTS __________________________")]
    385.         [Tooltip("The current data last recieved/given / not implemented yet")]
    386.         public CurrSystem CurrentData;
    387.         #endregion
    388.  
    389.     }
    390.     [Header("______ EXTRA _____________________")]
    391.     [Tooltip("Here you can enable/disable and set certain attributes of a generic character system")]
    392.     public extras Extra;
    393.     #endregion
    394.  
    395.     #region Hidden Variables
    396.     [HideInInspector]
    397.     public int m_XP = 0; /// The player's current score.
    398.     [HideInInspector]
    399.     public int m_level = 1;  /// The player's current level.
    400.     [HideInInspector]
    401.     public float alpha;
    402.     private bool DoOnce = true;
    403.     private bool PlayHungerOnce;
    404.     private bool PlayThirstOnce;
    405.     private bool PlayRestOnce;
    406.     private bool PlayBodyTempHotOnce;
    407.     private bool PlayBodyTempColdOnce;
    408.     private bool PlayOutofBreathOnce;
    409.     private bool leveled = false;
    410.     private const int MinimumLevel = 1; /// The minimum level permitted.
    411.     public int Score  /// The player's score.
    412.     {
    413.         get {return m_XP;} set {m_XP = value;}
    414.     }
    415.     public int Level
    416.     {
    417.         /// The player's current level. Specifying a new level will ensure that the
    418.         /// new level is clamped to the maximum permitted level.
    419.         get { return m_level; } set { m_level = Mathf.Clamp(value, MinimumLevel, PlayerLevel.m_maximumLevel);}
    420.     }
    421.     #endregion
    422.  
    423.  
    424.     public virtual void CheckForLevelUp() // check for level up
    425.     {
    426.         // if we have reached the maximum level, do nothing
    427.         if (m_level >= PlayerLevel.m_maximumLevel) {return;}
    428.  
    429.         // check for the next required score
    430.         int nextLevelScore = 0;
    431.         // if there are no more scores in the level score progression array
    432.         // switch over to linear progression
    433.         // otherwise, use the non-linear progression
    434.         if (m_level >= PlayerLevel.m_nextLevelScore.Length) { nextLevelScore = (m_level - PlayerLevel.m_nextLevelScore.Length + 1) * PlayerLevel.m_nextLevelScoreProgression; }
    435.         else { nextLevelScore = PlayerLevel.m_nextLevelScore[m_level]; }
    436.  
    437.         // if we have the required score to level up, advance to the next level
    438.         if (m_XP >= nextLevelScore)
    439.         {
    440.             m_XP = 0;
    441.             m_level = Math.Min(m_level + 1, PlayerLevel.m_maximumLevel);
    442.             PlayerLevel.PlayerLifetimeXP = PlayerLevel.PlayerLifetimeXP + PlayerLevel.PlayerCurrentXP;
    443.             // calculate level up multipliers //
    444.             int ihealth = (m_level) * PlayerLevel.LevelUpFeatures.VHealthMultiplier;
    445.             float iStamina = (m_level) * PlayerLevel.LevelUpFeatures.VStaminaMultiplier;
    446.             float ihunger = (m_level) * HungerThirstElements.HungerMultiplier;
    447.             float ithirst = (m_level) * HungerThirstElements.ThirstMultiplier;
    448.             float irest = (m_level) * HungerThirstElements.RestMultiplier;
    449.             float ibreath = (m_level) * HungerThirstElements.BreathMutiplier;
    450.             float ibodytemp = (m_level) * HungerThirstElements.BodyTempMutiplier;
    451.             //
    452.             int imana = (m_level) * PlayerAttibutes.ManaMultiplier;
    453.             //calculate new health and stamina //
    454.             InvectorStats.Vcurrent_health = InvectorBridge.myController.maxHealth + ihealth;
    455.             InvectorStats.Vcurrent_stamina = InvectorBridge.myController.maxStamina + iStamina;
    456.             //Mana
    457.             if (PlayerAttibutes.UseMana)
    458.             {
    459.                 PlayerAttibutes.CurrentMana = PlayerAttibutes.MaxMana + imana;
    460.                 PlayerAttibutes.MaxMana = PlayerAttibutes.MaxMana + imana;
    461.             }
    462.             // calculate hunger thirst system//
    463.             if (HungerThirstElements.UseHunger == true)
    464.             {
    465.                 HungerThirstElements.CurrentHunger = HungerThirstElements.MaxHunger + ihunger;
    466.                 HungerThirstElements.MaxHunger = HungerThirstElements.MaxHunger + ihunger;
    467.            
    468.             }
    469.             if (HungerThirstElements.UseThirst == true)
    470.             {
    471.                 HungerThirstElements.CurrentThirst = HungerThirstElements.MaxThirst + ithirst;
    472.                 HungerThirstElements.MaxThirst = HungerThirstElements.MaxThirst + ithirst;
    473.            
    474.  
    475.             }
    476.             if (HungerThirstElements.UseRest == true)
    477.             {
    478.                 HungerThirstElements.CurrentRest = HungerThirstElements.MaxRest + irest;
    479.                 HungerThirstElements.MaxRest = HungerThirstElements.MaxRest + irest;
    480.            
    481.             }
    482.             if (HungerThirstElements.UseBreath == true)
    483.             {
    484.                 HungerThirstElements.CurrentBreath = HungerThirstElements.MaxBreath + ibreath;
    485.                 HungerThirstElements.MaxBreath = HungerThirstElements.MaxBreath + ibreath;
    486.  
    487.             }
    488.  
    489.             if (HungerThirstElements.UseBodyTemp == true)
    490.             {
    491.                 HungerThirstElements.CurrentBodyTemp = HungerThirstElements.MaxBodyTemp + ibodytemp;
    492.                 HungerThirstElements.MaxBodyTemp = HungerThirstElements.MaxBodyTemp + ibodytemp;
    493.             }
    494.  
    495.             // update Vcontroller new health and new stamina //
    496.             InvectorBridge.myController.currentHealth = InvectorStats.Vcurrent_health;
    497.             InvectorBridge.myController.currentStamina = InvectorStats.Vcurrent_stamina;
    498.             InvectorBridge.myController.maxHealth = InvectorStats.Vcurrent_health;
    499.             InvectorBridge.myController.maxStamina = InvectorStats.Vcurrent_stamina;
    500.             // update player level and calculate new XP to next level //
    501.             PlayerLevel.PlayersLevel = m_level;
    502.             PlayerLevel.current_xp_to_nxt_Level = PlayerLevel.m_nextLevelScore[m_level];
    503.        
    504.             //clear all stats on level up
    505.             PlayerLevel.PlayerCurrentXP = 0;
    506.             HungerThirstElements.CurrentHunger = 0;
    507.             HungerThirstElements.CurrentThirst = 0;
    508.             HungerThirstElements.CurrentRest = 0;
    509.             HungerThirstElements.CurrentBreath = 0;
    510.             HungerThirstElements.CurrentBodyTemp = HungerThirstElements.MaxBodyTemp;
    511.             //
    512.             //play sound effect if any
    513.             if (PlayerLevel.LevelUpFeatures.m_LevelUpSound != null)
    514.             {
    515.                 PlayNextLevelSound(PlayerLevel.LevelUpFeatures.m_LevelUpSound);
    516.             }
    517.             // if level up particle VFX isnt empty instantiate FX at Player position //
    518.             if (PlayerLevel.LevelUpFeatures.LevelUpVFX != null)
    519.             {
    520.                 Instantiate(PlayerLevel.LevelUpFeatures.LevelUpVFX, transform.position + PlayerLevel.LevelUpFeatures.LevelUpVFXOffset, Quaternion.identity);
    521.                // Instantiate(LevelUpFeatures.LevelUpVFX, this.gameObject.transform.position, this.gameObject.transform.rotation);
    522.             }
    523.             //
    524.             if (PlayerLevel.LevelUpUIElements.levelUpScreenOverlay != null)
    525.             {
    526.                 PlayerLevel.LevelUpUIElements.levelUpScreenOverlay.CrossFadeAlpha(1f, 0.001f, false); // fade in full screen overlay
    527.                 PlayerLevel.LevelUpUIElements.levelUpScreenOverlay.CrossFadeAlpha(0.0f, PlayerLevel.LevelUpUIElements.levelUpScreenOverlayTime, false);
    528.             }
    529.             // play level up splash text and update GUI level if text is filled in
    530.             if (PlayerLevel.LevelUpUIElements.UI_MyLevelUpSplashText != null)
    531.             {
    532.                 PlayerLevel.LevelUpUIElements.UI_MyLevelUpSplashText.CrossFadeAlpha(1f, 0.01f, false);
    533.                 PlayerLevel.LevelUpUIElements.UI_MyLevelUpSplashText.text = "You've reached Level: " + Level.ToString();
    534.                 PlayerLevel.LevelUpUIElements.UI_MyLevelUpSplashText.CrossFadeAlpha(0.0f, PlayerLevel.LevelUpUIElements.SplashTexttime, false);
    535.             }
    536.             //adjust UI level number
    537.             if (PlayerLevel.LevelUpUIElements.UI_MyLevelNumber != null)
    538.             {
    539.                 PlayerLevel.LevelUpUIElements.UI_MyLevelNumber.text = "Level: " + Level.ToString();
    540.             }
    541.             leveled = true;
    542.         }
    543.     } // // close Check for LevelUp
    544.  
    545.     void Start () // Use this for initialization
    546.     {
    547.    
    548.         #region Invector Bridge
    549.         if (InvectorBridge.myController != null) // if controller is not active ignore
    550.         {
    551.             #region Playtime
    552.             if (Extra.Playtime.EnablePlaytime) { StartCoroutine("Playtimer"); }
    553.             #endregion
    554.  
    555.             InvectorStats.Vcurrent_health = InvectorBridge.myController.currentHealth;
    556.             InvectorStats.Vcurrent_stamina = InvectorBridge.myController.currentStamina;
    557.             InvectorStats.VMaxhealth = InvectorBridge.myController.maxHealth; // get invector MaxHealth
    558.             InvectorStats.VMaxstamina = InvectorBridge.myController.maxStamina; //get invector MaxStamina
    559.             InvectorStats.RecoveryStats.VhealthRecovery = InvectorBridge.myController.healthRecovery;
    560.             InvectorStats.RecoveryStats.VhealthRecoveryDelay = InvectorBridge.myController.healthRecoveryDelay;
    561.             InvectorStats.RecoveryStats.VstaminaRecovery = InvectorBridge.myController.staminaRecovery;
    562.  
    563.             PlayerLevel.current_xp_to_nxt_Level = PlayerLevel.m_nextLevelScore[m_level]; // get XP to next level
    564.             PlayerLevel.PlayersLevel = m_level;
    565.             HungerThirstElements.CurrentBodyTemp = HungerThirstElements.NormalBodyTemp;
    566.             if (PlayerAttibutes.UseMana)
    567.             {
    568.                 PlayerAttibutes.CurrentMana = PlayerAttibutes.MaxMana;
    569.             }
    570.             if (PlayerLevel.LevelUpUIElements.UI_MyLevelNumber != null)
    571.             {
    572.                 PlayerLevel.LevelUpUIElements.UI_MyLevelNumber.text = "Level: " + Level.ToString(); //update level to start level
    573.             }
    574.             if (PlayerLevel.LevelUpUIElements.UI_XPFillImage != null)
    575.             {
    576.                 PlayerLevel.LevelUpUIElements.UI_XPFillImage.fillAmount = 0; //empty XPbar graphic
    577.             }
    578.             if (HungerThirstElements.UI_HungerFillImage != null)
    579.             {
    580.                 HungerThirstElements.UI_HungerFillImage.fillAmount = 0; //empty hunger bar graphic
    581.             }
    582.             if (HungerThirstElements.UI_ThirstFillImage != null)
    583.             {
    584.                 HungerThirstElements.UI_ThirstFillImage.fillAmount = 0; //empty thirst graphic
    585.             }
    586.             if (HungerThirstElements.UI_RestFillImage != null)
    587.             {
    588.                 HungerThirstElements.UI_RestFillImage.fillAmount = 0; //empty rest bar graphic
    589.             }
    590.             if (HungerThirstElements.UI_BreathFillImage != null)
    591.             {
    592.                 HungerThirstElements.UI_BreathFillImage.fillAmount = 0; //empty breath graphic
    593.             }
    594.             if (HungerThirstElements.UI_BodyTempFillImage != null)
    595.             {
    596.                 HungerThirstElements.UI_BodyTempFillImage.fillAmount = HungerThirstElements.NormalBodyTemp; //empty bodytemp graphic
    597.             }
    598.             if (PlayerLevel.LevelUpUIElements.UI_MyLevelUpSplashText != null)
    599.             {
    600.                 PlayerLevel.LevelUpUIElements.UI_MyLevelUpSplashText.text = ""; //clear level up splash text
    601.             }
    602.             if (PlayerLevel.LevelUpUIElements.UI_XPGainedSplashText != null)
    603.             {
    604.                 PlayerLevel.LevelUpUIElements.UI_XPGainedSplashText.text = ""; //clear XP gained splash text
    605.             }
    606.             if (HungerThirstElements.UI_FrozenScreenOverlay != null)
    607.             {
    608.                 HungerThirstElements.UI_FrozenScreenOverlay.CrossFadeAlpha(0f, 0f, false);
    609.             }
    610.             if (HungerThirstElements.UI_HeatedScreenOverlay != null)
    611.             {
    612.                 HungerThirstElements.UI_HeatedScreenOverlay.CrossFadeAlpha(0f, 0f, false);
    613.             }
    614.             if (HungerThirstElements.UI_OutOfBreathOverlay != null)
    615.             {
    616.                 HungerThirstElements.UI_OutOfBreathOverlay.CrossFadeAlpha(0f, 0f, false);
    617.             }
    618.             if (PlayerLevel.LevelUpUIElements.levelUpScreenOverlay != null)
    619.             {
    620.                 PlayerLevel.LevelUpUIElements.levelUpScreenOverlay.CrossFadeAlpha(0f, 0f, false);
    621.             }
    622.             if (HungerThirstElements.UI_HungerScreenOverlay != null)
    623.             {
    624.                 HungerThirstElements.UI_HungerScreenOverlay.CrossFadeAlpha(0f, 0f, false);
    625.             }
    626.             if (HungerThirstElements.UI_ThirstScreenOverlay != null)
    627.             {
    628.                 HungerThirstElements.UI_ThirstScreenOverlay.CrossFadeAlpha(0f, 0f, false);
    629.             }
    630.             if (HungerThirstElements.UI_RestScreenOverlay != null)
    631.             {
    632.                 HungerThirstElements.UI_RestScreenOverlay.CrossFadeAlpha(0f, 0f, false);
    633.             }
    634.  
    635.         }
    636.         #endregion
    637.     }
    638.  
    639.     void Update() // Update is called once per frame
    640.     {
    641.    
    642.         #region Invector Bridge
    643.         if (InvectorBridge.myController != null) // if controller is not active ignore
    644.         {
    645.             CheckForLevelUp(); //check if we have enough XP to gain a level
    646.             if (leveled == true) { /* if i want to put something later */ }
    647.  
    648.             #region InvectorStats
    649.             InvectorStats.Vcurrent_health = InvectorBridge.myController.currentHealth;
    650.             InvectorStats.Vcurrent_stamina = InvectorBridge.myController.currentStamina;
    651.             InvectorStats.VMaxhealth = InvectorBridge.myController.maxHealth; // get invector MaxHealth
    652.             InvectorStats.VMaxstamina = InvectorBridge.myController.maxStamina; //get invector MaxStamina
    653.             InvectorStats.RecoveryStats.VhealthRecovery = InvectorBridge.myController.healthRecovery;
    654.             InvectorStats.RecoveryStats.VhealthRecoveryDelay = InvectorBridge.myController.healthRecoveryDelay;
    655.             InvectorStats.RecoveryStats.VstaminaRecovery = InvectorBridge.myController.staminaRecovery;
    656.             #endregion
    657.  
    658.          
    659.  
    660.             #region Playtime
    661.             if (Extra.Playtime.EnablePlaytime)
    662.             {
    663.                 if (Extra.Playtime.PlaytimeUIText != null)
    664.                 {
    665.                     Extra.Playtime.PlaytimeUIText.GetComponent<Text>().text = "You've stayed alive : " + Extra.Playtime.days.ToString() + ": Days " + Extra.Playtime.hours.ToString() + ": Hours " + Extra.Playtime.minutes.ToString() + ": minutes " + Extra.Playtime.seconds.ToString() + ": seconds ";
    666.                 }
    667.             }
    668.             #endregion
    669.  
    670.             #region XP
    671.             //XP  //
    672.             float PlayerXpPercent = PlayerLevel.PlayerCurrentXP / PlayerLevel.current_xp_to_nxt_Level; //calculate new XP to next level
    673.             if (PlayerLevel.LevelUpUIElements.UI_XPFillImage != null){ PlayerLevel.LevelUpUIElements.UI_XPFillImage.fillAmount = PlayerXpPercent;}
    674.             #endregion
    675.  
    676.             #region attributes
    677.             //ATTRIBUTES/// /// /// /// /// /// /// /// /// /// /// /// /// /// ///
    678.             ///  // Mana ///
    679.             if (PlayerAttibutes.UseMana == true)
    680.             {
    681.                 float ManaPercent = PlayerAttibutes.CurrentMana / PlayerAttibutes.MaxMana;
    682.                 if (PlayerAttibutes.UI_ManaFillImage != null) { PlayerAttibutes.UI_ManaFillImage.fillAmount = ManaPercent; }
    683.                 ///
    684.                 if (PlayerAttibutes.CurrentMana < PlayerAttibutes.MaxMana && !PlayerAttibutes.IsSpellCasting) {  PlayerAttibutes.CurrentMana += Time.deltaTime * PlayerAttibutes.ManaRegenModifier; } // if get too hungry lose stamina
    685.                 if (PlayerAttibutes.CurrentMana > 0 && PlayerAttibutes.IsSpellCasting ) {  PlayerAttibutes.CurrentMana  -= PlayerAttibutes.ManaCastingModifier * Time.deltaTime; }
    686.  
    687.             }
    688.             #endregion
    689.  
    690.             #region HungerThirstSystem
    691.             //HUNGER THIRST SYSTEM /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// ///
    692.             ///  // hunger ///
    693.             if (HungerThirstElements.UseHunger == true)
    694.             {
    695.                 float HungerPercent = HungerThirstElements.CurrentHunger / HungerThirstElements.MaxHunger;
    696.                 if (HungerThirstElements.UI_HungerFillImage != null) { HungerThirstElements.UI_HungerFillImage.fillAmount = HungerPercent; }
    697.                 ///
    698.                 if (HungerThirstElements.CurrentHunger < HungerThirstElements.MaxHunger) { HungerThirstElements.CurrentHunger += Time.deltaTime * HungerThirstElements.HungerModifier; } // if get too hungry lose stamina
    699.                 if (HungerThirstElements.CurrentHunger >= HungerThirstElements.MaxHunger) { InvectorBridge.myController.currentStamina -= Time.deltaTime * 65; }
    700.                 if (HungerThirstElements.UI_HungerScreenOverlay != null)
    701.                 {
    702.                     if (HungerThirstElements.CurrentHunger > HungerThirstElements.MaxHunger / 2)
    703.                     {
    704.                         HungerThirstElements.UI_HungerScreenOverlay.CrossFadeAlpha(1f, HungerThirstElements.UI_HungerScreenOverlayTime, false); // fade in full screen overlay
    705.                     }
    706.                     else
    707.                     {
    708.                         HungerThirstElements.UI_HungerScreenOverlay.CrossFadeAlpha(0.0f, HungerThirstElements.UI_HungerScreenOverlayTime, false);
    709.                     }
    710.                 }
    711.                 //
    712.                 if (HungerThirstElements.CurrentHunger < (HungerThirstElements.MaxHunger / 2)) { PlayHungerOnce = false; }
    713.                 //play sound effect if any
    714.                 if (HungerThirstElements.HungerCriticalSound != null && HungerThirstElements.CurrentHunger >= (HungerThirstElements.MaxHunger /1.06f) && PlayHungerOnce == false)
    715.                 {
    716.                     PlayNextLevelSound(HungerThirstElements.HungerCriticalSound);
    717.                     PlayHungerOnce = true;
    718.                
    719.                 }
    720.  
    721.             }
    722.             /// // thirst ///
    723.             if (HungerThirstElements.UseThirst == true)
    724.             {
    725.                 float ThirstPercent = HungerThirstElements.CurrentThirst / HungerThirstElements.MaxThirst;
    726.                 if (HungerThirstElements.UI_ThirstFillImage != null) { HungerThirstElements.UI_ThirstFillImage.fillAmount = ThirstPercent; }
    727.                 //
    728.                 if (HungerThirstElements.CurrentThirst < HungerThirstElements.MaxThirst) { HungerThirstElements.CurrentThirst += Time.deltaTime * HungerThirstElements.ThirstModifier; } // if get too thirsty lose health
    729.                 if (HungerThirstElements.CurrentThirst >= HungerThirstElements.MaxThirst) { InvectorBridge.myController.currentHealth -= Time.deltaTime * 2; }
    730.                 if (HungerThirstElements.UI_ThirstScreenOverlay != null)
    731.                 {
    732.                     HungerThirstElements.UI_ThirstScreenOverlay.CrossFadeAlpha(1f, 0.001f, false); // fade in full screen overlay
    733.                     HungerThirstElements.UI_ThirstScreenOverlay.CrossFadeAlpha(0.0f, HungerThirstElements.UI_ThirstScreenOverlayTime, false);
    734.                 }
    735.                 //
    736.                 if (HungerThirstElements.CurrentThirst < (HungerThirstElements.MaxThirst / 2)) { PlayThirstOnce = false; }
    737.                 //play sound effect if any
    738.                 if (HungerThirstElements.ThirstCriticalSound != null && HungerThirstElements.CurrentThirst >= (HungerThirstElements.MaxThirst / 1.06f) && PlayThirstOnce == false)
    739.                 {
    740.                     PlayNextLevelSound(HungerThirstElements.ThirstCriticalSound);
    741.                     PlayThirstOnce = true;
    742.  
    743.                 }
    744.             }
    745.             /// // rest ///
    746.             if (HungerThirstElements.UseRest == true)
    747.             {
    748.                 float RestPercent = HungerThirstElements.CurrentRest / HungerThirstElements.MaxRest;
    749.                 if (HungerThirstElements.UI_RestFillImage != null) { HungerThirstElements.UI_RestFillImage.fillAmount = RestPercent; }
    750.                 //
    751.                 if (HungerThirstElements.CurrentRest < HungerThirstElements.MaxRest) { HungerThirstElements.CurrentRest += Time.deltaTime * HungerThirstElements.RestModifier; }
    752.                 if (HungerThirstElements.CurrentRest >= HungerThirstElements.MaxRest) { /* do stuff if tired*/}
    753.                 if (HungerThirstElements.UI_RestScreenOverlay != null)
    754.                 {
    755.                     HungerThirstElements.UI_RestScreenOverlay.CrossFadeAlpha(1f, 0.001f, false); // fade in full screen overlay
    756.                     HungerThirstElements.UI_RestScreenOverlay.CrossFadeAlpha(0.0f, HungerThirstElements.UI_RestScreenOverlayTime, false);
    757.                 }
    758.                 if (HungerThirstElements.CurrentRest < (HungerThirstElements.MaxRest / 2)) { PlayRestOnce = false; }
    759.                 //play sound effect if any
    760.                 if (HungerThirstElements.RestCriticalSound != null && HungerThirstElements.CurrentRest >= (HungerThirstElements.MaxRest / 1.06f) && PlayRestOnce == false)
    761.                 {
    762.                     PlayNextLevelSound(HungerThirstElements.RestCriticalSound);
    763.                     PlayRestOnce = true;
    764.  
    765.                 }
    766.             }
    767.             /// // breath ///
    768.             if (HungerThirstElements.UseBreath == true)
    769.             {
    770.                 float BreathPercent = HungerThirstElements.CurrentBreath / HungerThirstElements.MaxBreath;
    771.                 if (HungerThirstElements.UI_BreathFillImage != null) { HungerThirstElements.UI_BreathFillImage.fillAmount = BreathPercent; }
    772.                 //
    773.                 if (HungerThirstElements.CurrentBreath < HungerThirstElements.MaxBreath+5 && HungerThirstElements.isHoldingBreath == false)
    774.                 {
    775.                     if (HungerThirstElements.CurrentBreath > 0f )
    776.                     {
    777.                         HungerThirstElements.CurrentBreath -= Time.deltaTime * 10f;
    778.                         if (HungerThirstElements.UI_OutOfBreathOverlay != null)
    779.                         {
    780.                             HungerThirstElements.UI_OutOfBreathOverlay.CrossFadeAlpha(0f, 5f, false); // fade in full screen overlay
    781.                         }
    782.  
    783.                     }
    784.                 }
    785.                 if (HungerThirstElements.CurrentBreath < HungerThirstElements.MaxBreath && HungerThirstElements.isHoldingBreath == true) { HungerThirstElements.CurrentBreath += Time.deltaTime * HungerThirstElements.BreathModifier; }
    786.                 //
    787.                 if (HungerThirstElements.CurrentBreath < (HungerThirstElements.MaxBreath / 2)) { PlayOutofBreathOnce = false; }
    788.                 //play sound effect if any
    789.                 if (HungerThirstElements.OutOfBreathCriticalSound != null && HungerThirstElements.CurrentBreath >= (HungerThirstElements.MaxBreath / 1.06f) && PlayOutofBreathOnce == false)
    790.                 {
    791.                     PlayNextLevelSound(HungerThirstElements.OutOfBreathCriticalSound);
    792.                     PlayOutofBreathOnce = true;
    793.  
    794.                 }
    795.                 if (HungerThirstElements.CurrentBreath >= HungerThirstElements.MaxBreath)
    796.                 { /* do stuff if winded/out of breath*/
    797.  
    798.                     if (HungerThirstElements.UI_OutOfBreathOverlay != null)
    799.                         {
    800.                         HungerThirstElements.UI_OutOfBreathOverlay.CrossFadeAlpha(1f, 5f, false); // fade in full screen overlay
    801.                         }
    802.                 }
    803.             }
    804.             /// // body temp ///
    805.             if (HungerThirstElements.UseBodyTemp == true)
    806.             {
    807.                 float BodyTempPercent = HungerThirstElements.CurrentBodyTemp / HungerThirstElements.MaxBodyTemp;
    808.                 if (HungerThirstElements.UI_BodyTempFillImage != null) { HungerThirstElements.UI_BodyTempFillImage.fillAmount = BodyTempPercent; }
    809.  
    810.                 GettingHot();
    811.                 GettingCold();
    812.            
    813.             }
    814.             #endregion
    815.  
    816.             #region Cheats
    817.             if (Extra.Cheatcodes.GodMode && InvectorBridge.myController.currentHealth < 99999f)
    818.             {
    819.                 Extra.Cheatcodes.OldCurrentHealth = InvectorBridge.myController.currentHealth;
    820.                 Extra.Cheatcodes.OldCurrentStamina = InvectorBridge.myController.currentStamina;
    821.                 Extra.Cheatcodes.OldCurrentMaxHealth = InvectorBridge.myController.maxHealth;
    822.                 Extra.Cheatcodes.OldCurrentMaxStamina= InvectorBridge.myController.maxStamina ;
    823.                 InvectorBridge.myController.currentHealth = 99999f;
    824.                 InvectorBridge.myController.maxHealth = 99999f;
    825.                 InvectorBridge.myController.currentStamina = 99999f;
    826.                 InvectorBridge.myController.maxStamina = 99999f;
    827.                 DoOnce = false;
    828.             }
    829.             if (!Extra.Cheatcodes.GodMode && DoOnce == false )
    830.             {
    831.                 InvectorBridge.myController.currentHealth = Extra.Cheatcodes.OldCurrentHealth;
    832.                 InvectorBridge.myController.currentStamina = Extra.Cheatcodes.OldCurrentStamina;
    833.                 InvectorBridge.myController.maxHealth = Extra.Cheatcodes.OldCurrentMaxHealth;
    834.                 InvectorBridge.myController.maxStamina = Extra.Cheatcodes.OldCurrentMaxStamina;
    835.                 DoOnce = true;
    836.             }
    837.  
    838.             #endregion
    839.  
    840.         } // close if controller null
    841.         #endregion
    842.     } // close void Update()
    843.  
    844.     public void PlayNextLevelSound(AudioClip playsound ) // Play the audio for level up sound.
    845.     {
    846.         GameObject audioObject = null;
    847.         if (InvectorBridge.audioSource != null)
    848.             audioObject = Instantiate(InvectorBridge.audioSource.gameObject, this.transform.position, Quaternion.identity) as GameObject;
    849.         else
    850.         {
    851.             audioObject = new GameObject("audioObject");
    852.             audioObject.transform.position = this.transform.position;
    853.         }
    854.         if (audioObject != null)
    855.         {
    856.             var source = audioObject.gameObject.GetComponent<AudioSource>();
    857.             var clip = playsound;
    858.             source.PlayOneShot(clip);
    859.         }
    860.     }
    861.  
    862.     public void AdjustLevel(int levels) // Adjust the current level by the specified number of levels
    863.     /// Adjust the current level by the specified number of levels. Negative
    864.     /// values will subtract levels. Does not adjust the score to match. The
    865.     /// new level will be clamped to within the maximum permitted level.
    866.     /// int levels is Number of levels to adjust the current level
    867.     {
    868.         m_level = Mathf.Clamp(m_level + levels, MinimumLevel, PlayerLevel.m_maximumLevel);
    869.     }
    870.  
    871.     public void AdjustScore(int iXP) // Adjust the score
    872.     {
    873.         m_XP += iXP;
    874.     }
    875.  
    876.     public void GettingHot()
    877.     {
    878.         if (HungerThirstElements.isGettingHot ) // getting hot
    879.  
    880.         {
    881.             if (HungerThirstElements.CurrentBodyTemp <= HungerThirstElements.NormalBodyTemp+10)
    882.             {
    883.                 if (HungerThirstElements.UI_HeatedScreenOverlay != null)
    884.                 {
    885.                     HungerThirstElements.UI_HeatedScreenOverlay.CrossFadeAlpha(0f, 5f, false); // fade in full screen overlay
    886.                 }
    887.             }
    888.  
    889.             if (HungerThirstElements.CurrentBodyTemp <= HungerThirstElements.MaxBodyTemp && (HungerThirstElements.CurrentBodyTemp > HungerThirstElements.NormalBodyTemp - 1))
    890.             {
    891.                 HungerThirstElements.CurrentBodyTemp += Time.deltaTime * HungerThirstElements.BodyTempModifier; //raise body temp
    892.             }
    893.        
    894.             //play sound effect if any
    895.             if (HungerThirstElements.HeatedCriticalSound != null && HungerThirstElements.CurrentBodyTemp >= (HungerThirstElements.MaxBodyTemp/1.08f) && PlayBodyTempHotOnce == false)
    896.             {
    897.                 PlayNextLevelSound(HungerThirstElements.HeatedCriticalSound);
    898.                 PlayBodyTempHotOnce = true;
    899.  
    900.             }
    901.             if (HungerThirstElements.CurrentBodyTemp >= HungerThirstElements.NormalBodyTemp + 20f)
    902.             {
    903.                 if (HungerThirstElements.UI_HeatedScreenOverlay != null)
    904.                 {
    905.                     HungerThirstElements.UI_HeatedScreenOverlay.CrossFadeAlpha(1f, 5f, false); // fade in full screen overlay
    906.                 }
    907.             }      
    908.         }
    909.         if (HungerThirstElements.isGettingHot ==  false) // getting hot
    910.  
    911.         {
    912.             if (HungerThirstElements.CurrentBodyTemp > HungerThirstElements.NormalBodyTemp)
    913.             {
    914.                 HungerThirstElements.CurrentBodyTemp -= Time.deltaTime * HungerThirstElements.BodyTempModifier; // lower body temp to normal
    915.             }
    916.             if (HungerThirstElements.CurrentBodyTemp < HungerThirstElements.MaxBodyTemp +20)
    917.             {
    918.                 if (HungerThirstElements.UI_HeatedScreenOverlay != null)
    919.                 {
    920.                     HungerThirstElements.UI_HeatedScreenOverlay.CrossFadeAlpha(0f, 5f, false);
    921.                 }
    922.             }
    923.         }
    924.  
    925.     }
    926.  
    927.     public void GettingCold()
    928.     {
    929.         if (HungerThirstElements.isGettingCold) // getting cold
    930.  
    931.         {
    932.             if (HungerThirstElements.CurrentBodyTemp <= HungerThirstElements.NormalBodyTemp - 10f)
    933.             {
    934.                // if (Camera.main.GetComponent<StartFrost>() != null) //custom frosting screen unavailable to public
    935.                // {
    936.                //     Camera.main.GetComponent<StartFrost>().startfrosting = true;//custom frosting screen unavailable to public
    937.                // }
    938.             }
    939.  
    940.             if (HungerThirstElements.CurrentBodyTemp >= -10f)
    941.             {
    942.                 HungerThirstElements.CurrentBodyTemp -= Time.deltaTime * HungerThirstElements.BodyTempModifier; //lower body temp
    943.             }
    944.  
    945.             if (HungerThirstElements.CurrentBodyTemp < HungerThirstElements.NormalBodyTemp - 30f)
    946.             {
    947.                 if (HungerThirstElements.UI_FrozenScreenOverlay != null)
    948.                 {
    949.                     HungerThirstElements.UI_FrozenScreenOverlay.CrossFadeAlpha(1f, 5f, false); // fade in full screen overlay
    950.                 }
    951.                // if (Camera.main.GetComponent<StartFrost>() != null) //custom frosting screen unavailable to public
    952.                // {
    953.                //     Camera.main.GetComponent<StartFrost>().MaxFrostAllowed = 0.38f;//custom frosting screen unavailable to public
    954.                // }
    955.             }
    956.             if (HungerThirstElements.CurrentBodyTemp <= HungerThirstElements.NormalBodyTemp - 50f)
    957.             {
    958.                 //Camera.main.GetComponentInChildren<UnityStandardAssets.ImageEffects.MotionBlur>().enabled = true; // enable motion blur if you have it added to camera
    959.             }
    960.             if (HungerThirstElements.CurrentBodyTemp > HungerThirstElements.NormalBodyTemp - 50f)
    961.             {
    962.                 //Camera.main.GetComponentInChildren<UnityStandardAssets.ImageEffects.MotionBlur>().enabled = false; // disable motion blur if you have it added to camera
    963.             }
    964.  
    965.                  //play sound effect if any
    966.             if (HungerThirstElements.FrozenCriticalSound != null && HungerThirstElements.CurrentBodyTemp < (HungerThirstElements.NormalBodyTemp/2.55f) && PlayBodyTempColdOnce == false)
    967.             {
    968.                 PlayNextLevelSound(HungerThirstElements.FrozenCriticalSound);
    969.                 PlayBodyTempColdOnce = true;
    970.  
    971.             }
    972.         }
    973.  
    974.         if (HungerThirstElements.isGettingCold == false) // getting cold false
    975.  
    976.         {
    977.             if (HungerThirstElements.CurrentBodyTemp >= (HungerThirstElements.NormalBodyTemp - 1) && HungerThirstElements.CurrentBodyTemp <= (HungerThirstElements.NormalBodyTemp + 1)) { PlayBodyTempColdOnce = false; PlayBodyTempHotOnce = false; }
    978.  
    979.             if (HungerThirstElements.CurrentBodyTemp < HungerThirstElements.NormalBodyTemp)
    980.             {
    981.                 HungerThirstElements.CurrentBodyTemp += Time.deltaTime * HungerThirstElements.BodyTempModifier; //lower body temp
    982.  
    983.             }
    984.             if (HungerThirstElements.CurrentBodyTemp > HungerThirstElements.NormalBodyTemp - 20f)
    985.             {
    986.                // if (Camera.main.GetComponent<StartFrost>() != null) //custom frosting screen unavailable to public
    987.                // {
    988.                //     Camera.main.GetComponent<StartFrost>().MaxFrostAllowed = 0.33f;//custom frosting screen unavailable to public
    989.                //     Camera.main.GetComponent<StartFrost>().startfrosting = false;//custom frosting screen unavailable to public
    990.                // }
    991.                 if (HungerThirstElements.UI_FrozenScreenOverlay != null)
    992.                 {
    993.                     HungerThirstElements.UI_FrozenScreenOverlay.CrossFadeAlpha(0f, 5f, false);
    994.                 }
    995.            
    996.             }
    997.  
    998.             if (HungerThirstElements.CurrentBodyTemp > 0f)
    999.             {
    1000.                 if (HungerThirstElements.UI_FrozenScreenOverlay != null)
    1001.                 {
    1002.                     HungerThirstElements.UI_FrozenScreenOverlay.CrossFadeAlpha(0f, 5f, false);
    1003.                 }
    1004.  
    1005.             }
    1006.  
    1007.             if (HungerThirstElements.CurrentBodyTemp > 0f)
    1008.             {
    1009.                 if (HungerThirstElements.UI_FrozenScreenOverlay != null)
    1010.                 {
    1011.                     HungerThirstElements.UI_FrozenScreenOverlay.CrossFadeAlpha(0f, 5f, false);
    1012.                 }
    1013.                // if (Camera.main.GetComponent<StartFrost>() != null) //custom frosting screen unavailable to public
    1014.                // {
    1015.                //     Camera.main.GetComponent<StartFrost>().MaxFrostAllowed = 0.33f;//custom frosting screen unavailable to public
    1016.                // }
    1017.             }
    1018.         }
    1019.  
    1020.     }
    1021.  
    1022.     private IEnumerator Playtimer()
    1023.     {
    1024.         while (true)
    1025.         {
    1026.             yield return new WaitForSeconds(1);
    1027.             Extra.Playtime.playtime += 1;
    1028.             Extra.Playtime.seconds = (Extra.Playtime.playtime % 60);
    1029.             Extra.Playtime.minutes = (Extra.Playtime.playtime / 60) % 60;
    1030.             Extra.Playtime.hours = (Extra.Playtime.playtime / 3600) % 24;
    1031.             Extra.Playtime.days = (Extra.Playtime.playtime / 86400) % 365;
    1032.         }
    1033.     }
    1034.  
    1035.  
    1036.  
    1037. }
    1038.  

    Next create another c# script and call it - InvectorAIAddon -

    and open it up and erase all inside and copy/paste this code

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Invector.CharacterController;
    4. using System.Collections.Generic;
    5.  
    6. public class InvectorAIAddon : MonoBehaviour {
    7.     [Header("______ STATS _____________________________")]
    8.     public int XPGainedOnDeath = 100; //amount of XP for killing
    9.     public float CurrentHealth; //current hp
    10.  
    11.     [System.Serializable]
    12.     public class DropItemonDeath
    13.     {
    14.         public GameObject[] DropRandomItemOnDeathPrefab;
    15.         [Range(0, 100)]
    16.         public float DropItemChancePercent = 15f; //out of 100
    17.         public Vector3 dropItemOffset = new Vector3(0.5f, 0.5f, 0.5f);
    18.     }
    19.     [Header("______ LOOT SYSTEM _____________________________")]
    20.     [Tooltip("Here you can add a random item drop from an array of objects")]
    21.     public DropItemonDeath LootDropSystem;
    22.  
    23.     private GameObject Player;//Player
    24.     private bool DoOnce;
    25.    
    26.  
    27.     void Update ()// Update is called once per frame
    28.     {
    29.         Player = (GameObject)GameObject.FindGameObjectWithTag("Player"); // find the player /single player method only atm
    30.         if (GetComponent<Invector.vCharacter>() != null) // if controller is not active ignore
    31.         {
    32.             CurrentHealth = GetComponent<Invector.vCharacter>().currentHealth; // get enemies current health
    33.             if (CurrentHealth <= .01f) // if health is less than trigger death events
    34.             {
    35.                 iDied(); // death event
    36.             }
    37.         }
    38.  
    39.     }
    40.  
    41.     public void iDied() // death events
    42.     {
    43.         if (DoOnce == false)
    44.         {
    45.             if (Player.GetComponentInParent<InvectorAddOn>() != null) // if invector addon doesnt exist ignore
    46.             {
    47.                 Player.GetComponentInParent<InvectorAddOn>().m_XP = Player.GetComponentInParent<InvectorAddOn>().m_XP + XPGainedOnDeath;
    48.                 Player.GetComponentInParent<InvectorAddOn>().PlayerLevel.PlayerCurrentXP = Player.GetComponentInParent<InvectorAddOn>().PlayerLevel.PlayerCurrentXP + XPGainedOnDeath;
    49.                 if (Player.GetComponentInParent<InvectorAddOn>().PlayerLevel.LevelUpUIElements.UI_XPGainedSplashText != null) // if spash text gui is undefined ignore
    50.                 {
    51.                     Player.GetComponentInParent<InvectorAddOn>().PlayerLevel.LevelUpUIElements.UI_XPGainedSplashText.CrossFadeAlpha(1f, 0.01f, false);
    52.                     Player.GetComponentInParent<InvectorAddOn>().PlayerLevel.LevelUpUIElements.UI_XPGainedSplashText.text = "XP Gained: " + XPGainedOnDeath.ToString();
    53.                     Player.GetComponentInParent<InvectorAddOn>().PlayerLevel.LevelUpUIElements.UI_XPGainedSplashText.CrossFadeAlpha(0.0f, Player.GetComponentInParent<InvectorAddOn>().PlayerLevel.LevelUpUIElements.XPGainedSplashTextTime, false);
    54.                 }
    55.  
    56.                 //do we need to drop an item?
    57.                 if (LootDropSystem.DropRandomItemOnDeathPrefab.Length > 0)
    58.                 {
    59.                     int iRndB = Random.Range(1, 99);
    60.                     if (iRndB < LootDropSystem.DropItemChancePercent)
    61.                     {
    62.                         DropRandomItem();
    63.                     }
    64.                 }
    65.             }
    66.             DoOnce = true;
    67.  
    68.         }
    69.     }
    70.  
    71.     public void DropRandomItem()
    72.     {
    73.         GameObject DroppedItem = LootDropSystem.DropRandomItemOnDeathPrefab[Random.Range(0, LootDropSystem.DropRandomItemOnDeathPrefab.Length)];
    74.  
    75.         Instantiate(DroppedItem, transform.position + LootDropSystem.dropItemOffset, Quaternion.identity);
    76.     }
    77. }
    78.  


    Steps for Player:
    1) Add the InvectorAddOn to your ThirdPersonPlayer
    2) in the Inspector open the Invector Bridge part and assign your player to the MyController field (this step is important)
    3) in your Invector3rdPersonController->Scripts->Footstep->Audiosource folder there is an "audiosource" prefab, drag it into the Audiosource component of the InvectorBridge area.
    4) optionally mess around with all the other features. any questions about how something works or what it does feel free to ask or mssg me.

    Steps for Enemies:
    1) add the InvectorAIAddon script to any enemies
    2) adjust XP and if you want random item drops on death.

    that's it.
    hope it helps someone out.

    NOTES: the UI_Fill textures components are UI Textures created under the InvectorHUD (just rightclick-create new UI-Texture and adjust anchors how you want. set Image texture to Fill (however you want, radial, bar etc) the code will handle making the values adjust.

    the UI Overlay textures are/were designed for full screen awareness similar to blood splat screen on take damage (think screen changing blue hue when temp is below freezing, turns red when overheated, blurry when holding breath past max, etc)
     
    Last edited: Jun 28, 2016
    Shadex, Invector and Kenaz like this.
  17. jgiroux

    jgiroux

    Joined:
    Jul 21, 2015
    Posts:
    22
     
  18. spinaLcord

    spinaLcord

    Joined:
    May 25, 2015
    Posts:
    29
    I love this asset, but is there a way to fix crashes after closing Unity? Everything is up to date, and re-imported.
     
  19. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    It just sort of went away for me. Also, apparently not a problem with this kit but one with Unity. I reported it to Unity and they said it's fixed in next update.
     
  20. spinaLcord

    spinaLcord

    Joined:
    May 25, 2015
    Posts:
    29
    Thanks, good to know.
     
  21. Ghost_Interactive

    Ghost_Interactive

    Joined:
    Jul 8, 2015
    Posts:
    54
    I have a small question, can i make a shooter project with this asset. i am very interested in this asset because of its very easy to use.
     
  22. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    134
    yes u can but u will need to add animations and weapon system
     
  23. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    326
    Just grabbed this, and in general I like what I see. Out of the box, it seems tailor made for something like Dark Souls, which is cool. Unfortunately, I want to use it for something faster paced like God of War or Devil May Cry.

    Smooth gameplay, tight controls, quick response, and unambiguous player feedback are more important to me than pretty animation transitions.

    1: Is there any way to make attacks faster without editing the animations themselves? I went through the state machine changing speeds from 1 to 8, but all that did was make the walking 8x as fast. Nothing in the Right Arm seemed to have any effect on attack animation speed. I need to be able to tweak this in Unity/scripts because that's where the gameplay happens.

    2: Likewise, is there any way to fine tune rotation/movement in Unity/scripts? I turned off Recoil Animation and Turn On Spot, which helped somewhat, but there's still some clunky movement when trying to turn to face an opponent.

    3: How should I implement default attacks using punches/kicks?

    4: In general, it feels like you give the animator too much control over factors which directly affect the gameplay. Is there a way to change this behavior? Animation should follow gameplay, not the other way around.

    5: Combos feel inconsistent. Mashing left-click as fast as possible sometimes results in a 3x combo, sometimes it only does one attack, followed by a full idle loop, before the next attack comes out. Disregard this one. I just noticed the stamina meter. I'm apparently blind. o_O

    Thank you!
     
    Last edited: Jun 26, 2016
  24. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Make or import your own animations i guess.
     
  25. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    326
    It just feels weird doing that kind of game balancing in an animation program. If I want to tweak the speeds late in production, I'll have to redo the animations. D:
     
  26. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
  27. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    326
    Aha! That's what I needed to know. Thanks! :D

    I thought I had tried all the numbers in there, but I didn't realize I had to click through layers to find the actual attack animations.

    Update: Further improved attack animations by trimming the fat on import... mostly I got rid of the little awkward recoil motions after a swing but before the next swing. It still looks fluid in-game.

    Disabled the Stamina meter by adding currentStamina = maxStamina; in vThirdPersonController.cs. This is a disgusting hack, but I couldn't think of a cleaner way to do it without tearing apart the whole script and the scripts it inherits from. I'll kill the stamina bar graphic in the hud later.

    Added some extra movement and increased the turn speeds. Movement and attacks feel okay now. Swing arcs aren't great but I'll take care of that when I add my own animations later.

    Now all I need to know is: how do you specify a default weapon that is already equipped when you start the game/respawn?

    Thanks in advance! :)
     
    Last edited: Jun 26, 2016
    wood333 likes this.
  28. jgiroux

    jgiroux

    Joined:
    Jul 21, 2015
    Posts:
    22
    just drag your weapon you'd like into your characters weapon handler so if its a sword, drag it into your handler@sword handler on your character, if your character doesn't have one goto 3rd person controller in tool bar, and find melee manager there or add via component in inspector. check the tutorial video on how to set up weapon handlers.
     
    jcarrick and Invector like this.
  29. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Yeah I'm also getting this anoying crash on Unity 5.3.5, other versions are fine!
    We already report to Unity and hopefuly it should be fixed on next version, but try deleting your Library, it may go aways.

    Sure you can, but keep in mind that we're working on the Shooter Template now ;)

    The answer to all your 3 questions is only one: Animations :p
    Basically animations very important for 3rd person games, if you have faster animations you will have faster movements. But yeah, you could use a little script to make things smoother, and we did :), next version v1.3e will have indenpendly values to help your rigibody to move:



    Before we used transform.position which is not the best way, neather the safest (collision), and now is smoother then ever :D

    * next post *
    Some of the awesome fellas around answer your questions, thanks guys :p

    ps* like I say on the top of this page, you can 0 the stamina values individualy on the Actions Painel for actions and on at the HitBox of your weapon too.

     
  30. tubbz0r

    tubbz0r

    Joined:
    May 24, 2014
    Posts:
    72
    How would we go about being able to attack while running at the same time? when swinging weapons it seems to stop / halt your character before swinging. Any possibility of swinging while still running?
     
  31. SingularitySystems

    SingularitySystems

    Joined:
    Feb 10, 2014
    Posts:
    48
    Hey Invector, got a bug for you. This is reproducible with the vanilla Asset and nothing changed script side.

    When I'm locked on to things, and attack, the character doesn't always correct their facing as they move. I have to consistently drop and re-lock my target over and over to keep it facing the target. A fix might be to soft-reacquire target at the conclusion of the attack animation without losing the current lock state.

    Here's a video. It's unlisted so you should only be able to access it through this link:


    Sorry about the music, I was listening to something while I was working.
     
  32. MandatoryDenial

    MandatoryDenial

    Joined:
    Jun 21, 2016
    Posts:
    20
    Hi, I am new to unity development, a teacher who is trying to implement a game design class as a part of a STEM course and I am hoping someone here who follows this app has experienced this bug and can help me. First off I am working on the steps described in the youtube video for setting up a character. Once I use their steps to create an invector bot player I find myself unable to do anything other than move. When I press the jump key for instance it looks like its trying to switch between controller and keyboard settings. The icons on the top left switch out between modes and a message flashes at the top "Control scheme changed to keyboard/mouse." Has anyone encountered and overcame this error because I can't seem to get past it.
     
  33. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Thanks but I'm not asking for a thing like Euphoria Engine. That's too complex. What I mean is: when the enemy is hit and the hit reaction animation is playing, can I also insert my custom behaviour to your code, to force the character to move backward a fixed distance like 5 world units. Similar effect can be achieved by myself with my own code. e.g to apply a constant force or just translate the character 5 units away along the z-axis. Can I do that with your 3rd Personal template?
     
  34. Shadex

    Shadex

    Joined:
    Dec 18, 2013
    Posts:
    89
    Thank you so much for adding this.
     
    jgiroux likes this.
  35. snackzilla

    snackzilla

    Joined:
    Aug 17, 2014
    Posts:
    91
    Hello again Invector! Still working with Inventory Pro. What I'm trying to do is effectively have a weapon in the appropriate handler, and turn it on/off with the game object itself. Looking at vMeleeManager, I see you have a void Start() that runs once when the scene is initiated to detect weapons that are already equipped (So you can start with an equipped weapon). What I'm trying to do is start with the weapon equipped in the appropriate handler, but have the game object itself turned off..Then when you enable the game object(in my case, via script once the visual representation is equipped in Inventory Pro), it will not only enable the mesh/hitboxes, but also change the animator state for the weapon. If I change your void Start() to a void Update(), it will work...But when I turn the object back off (via script once I dequip it in Inventory Pro), the animator stays in the state that I had connected to the weapon. Any suggestions? :)

    Also..Since this system is HEAVILY reliant on animation, and animation states, an incredible addition would be the ability to change the MoveSet_ID, ATK_ID, and DEF_ID in the inspector and not have them so reliant on weapons..Sometimes I'd like to code an item, but not necessarily a weapon that would change the float value of one of the animation parameters and have it reflected in the character animation, however it seems that unless the system detects an Invector weapon equipped, It will automatically change itself back to the default value. Just food for thought. :D
     
  36. Shadex

    Shadex

    Joined:
    Dec 18, 2013
    Posts:
    89
    First thing is that there is now an option in Melee Attack Manager script (the one on the animation states in mecanim). It is called Allow Movement At and basicly it allows movement at a certain time during an animation. If you combine that with a root motion step and swing animation you have the traiditional dark souls running attack. You can play with the exit time to make get you back to running after its done if you want to make it feel more smooth.

    Now if you want to freely run around and swing, just use the body layers to setup a state in the upper body with an attack animation with root motion turned off on the specific animation and add the transition logic speed > X and Melee Attack. The problem with this approach is it looks REALLY bad. You look like a 5 year old running around swinging a stick.
     
    Invector likes this.
  37. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    That all seems rather complex. Does inventory pro allow you to instantiate a prefab to a weapon mount of some sort? I'm using Okashi Framework inventory and that's what it does. Then it's just a simple matter of changing "currentMeleeWeaponRA" (or "currentMeleeWeaponLA") in vMeleeManager.

    This is the script I use for it:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class MeleeWeaponController : MonoBehaviour {
    5.     public vMeleeManager myvMeleeManager;
    6.     public vMeleeWeapon currentMeleeWeaponRA;
    7.     // Use this for initialization
    8.     void OnEnable() {
    9.         currentMeleeWeaponRA = GetComponentInChildren<vMeleeWeapon>();
    10.         myvMeleeManager = GetComponentInParent<vMeleeManager>();
    11.         if (myvMeleeManager != null) myvMeleeManager.InitCustomMeleeWeapon();
    12.     }
    13.  
    14.     // Update is called once per frame
    15.     void Update () {
    16.         if (myvMeleeManager == null)
    17.         {
    18.             myvMeleeManager = GetComponentInParent<vMeleeManager>();
    19.             if (myvMeleeManager != null) myvMeleeManager.InitCustomMeleeWeapon();
    20.          
    21.         }
    22.         if(myvMeleeManager!=null)
    23.         {
    24.             if(myvMeleeManager.currentMeleeWeaponRA!=currentMeleeWeaponRA) myvMeleeManager.InitCustomMeleeWeapon();
    25.         }
    26.     }
    27. }
    28.  
    Add this to any thing with vMeleeWeapon as a child and as long as it is mounted to a "handler@weaponName" it works fine. Just make sure the coilliders are turned off on the prefab, otherwise you'll end up with some silly physics issues like the player suddenly being thrown right off the screen. I know if can use some refining but it serves its purpose and is good enough to keep working. I'll refine it later if I need to free up a few milliseconds. :)
     
    Invector, TeagansDad and snackzilla like this.
  38. snackzilla

    snackzilla

    Joined:
    Aug 17, 2014
    Posts:
    91

    It does let you instantiate an item to a specified mount point. The issue I was having was that even when Inventory Pro would instantiate the item to the specified mount point, it wouldn't change the MoveSet_ID/Atk_ID, ect. I was trying to call on SetWeaponRight/LeftHandler(SpecifiedMeleeWeapon), instead of CurrentMeleeWeapon, so I'll try this and get back with you! Thank you in advance for your input! :)

    EDIT: HOLY CRAP IT WORKS. Drew, you are a lifesafer. I can finally get on with things.
     
    Last edited: Jun 27, 2016
  39. Shadex

    Shadex

    Joined:
    Dec 18, 2013
    Posts:
    89
    Lol that sounds like a copy and paste from a game design doc. Your using root motion as a controller, the animation transitions are what controls the feel (aka quick response, unambiguous player feed back and tight controls). What you want to do is play with the exit timing in Mecanim and state priority to allow animation canceling and tight combo's (IE swing left can be left alone to fully swing left, or it can have an exit time at 80% which will stop the transition at 80% an start the swing right animation on the next button press, this make the swing right start at 80% of swing left to make a fluid combo. Also under Melee Attack Behavior there is "Allow movement at" variable which will allow the character to move while in the animation.

    an animation speed of 8 is 8 times faster, the character is going to swing so fast you most likely wont see it. Try 1.5 or 2. If that is not fast enough then you need 60 frame per second animations or better so you can speed things up and not look choppy. Also its not under "Right Arm" its under "Full Body -> Basic Attack" which is setup for default swords. All the attack animation state groups reside in Full Body on the vanilla install. Also on third person controller script (on your main character) you can change walk and strafe speed. Try a value of 2-3 on it.

    Melee Attack Behavior on the actual attack animation's. Change the variable "Allow movement at" to when you want the character to move during that animation. Set to 0 to allow for turning and barely walk movement during the entire animation.

    In Mecanim go to Full Body -> Default Animation. Add your hand to hand animations in the states. Make sure they have a melee attack beahvior script or they will not do damage.

    Again your using root motion. Animation IS the gameplay. Root motion takes the movement from the animations themselfs and makes the character's position in 3d space follow those movements. Without root motion, attack's and movement look like ice skating. This is how god of war, devil may cry, and pretty much every 3rd person game in the last 5-10 years has done it. A good way to test is try moving the character on a dash attack on these games. Your input is not moving them, the animation is.

    Something that may help you, go to Maximo, and get a bunch of free animations (sword and shield, two handed, etc) you can combine many of these to make some pretty nice looking combo's. Pick the 60 Frames per second option when you download them. The downloading from that site takes a few to get use to, but you should be able to get pretty much the basic DMC combo's and attacks working (minus the gun until they finish the shooter template) without writing any code. I actually pieced together the full combo from Witcher 3 from the free animations they have, I have the Karma and Hacker combo's working from DMC 2013 from there as well. Just understand that DMC sword swing particle effects on "on hit" particle effects where alot of what made those combo's flashy and cool.

    Oh and to do the Dante/God of war mid air-never-fall-down-combo's just comment out the no jump conditions on attack in the code.
     
  40. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    You're welcome. I was about to tell you that setting the weapons this way ALSO sets the various IDs. Or seems to anyway. But I guess you see that now. :)
     
  41. snackzilla

    snackzilla

    Joined:
    Aug 17, 2014
    Posts:
    91
    Absolutely amazing. Would there be any way to edit this to take advantage of multiple weapon handlers on the same hand? I mean, I can edit the position and rotation of my individual weapon models before I make them an Invector weapon prefab, I'm just being lazy.
     
  42. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    I think shadex answer pretty well your question, we did test attack while running using the arms layer, but it does look like a 5 year kid running lol

    Pretty relax song you got there hahaah, well I try to reproduce your issue here and no success, maybe I already fix? anyways, v1.3e is coming very soon and the lock-on will work like expected

    I'm pretty sure that you replace the Input Settings by importing another complet project... Try create another project and be very carefull when importing another complete project, take a look on the Documentation at the beginning we show a picture of how avoid replace the project settings.

    Well it's easier if you have an animation that has 5 world units, then just trigger this animation... because if you do it by code it will look like the enemy is floating around

    @drewradley You sir are awesome ;) - thanks for all the help around here :p
     
  43. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I'm sure that's possible but I designed it specifically for one weapon on one handler at a time. You'll probably need an array or list to use various weapon handlers. I don't know how Inventory Pro works, but in ORK I can have different weapon mounts that block other mounts so I set mine up so I have an inventory slot for each of the weapon types that mount to the different handlers and have it set up so player can only have one weapon on one handler. So if a player has an axe equipped and want a sword, the axe is automatically removed from handler@axe and the sword is put on handler@sword and everything is then set by that script. I also made the model of the weapon as a child so I can simply put new art over the old art, get rid of the old art, tweak the settings and hit collider as needed and new weapon made.

    I figure every minute I spend answering questions like these is another minute you can be working on upgrades and the shooter kit! Especially ones I have already done like this one!

    Oh, and you are welcome to include any of the code snippets I post here (or portions thereof) if you want them, but I suspect anything I can do, you can do better. :)
     
    Last edited: Jun 27, 2016
  44. jgiroux

    jgiroux

    Joined:
    Jul 21, 2015
    Posts:
    22
    I am still adding to it, and making more modifications which I will continue to update, its certainly not the best system out there but I suspect there is enough in that code to help coders with their own ideas.

    p.s. @anyone, feel free to use scripts or snippets in anyway you see fit to. Im giving this code freely to community and Invector.
     
    SingularitySystems likes this.
  45. MandatoryDenial

    MandatoryDenial

    Joined:
    Jun 21, 2016
    Posts:
    20
    Invector crew, thanks for the help you have been giving via email. I have two more questions for you now that everything works as is:

    In the animation controller, combatcontroller, I am trying to replace the idle animation but the best I can do is a animation that plays only once, any ideas on where I should be looking in order to play an idle animation or better yet a group of them continuously?

    Also when I try to replace the walking animation with an animation that looks more zombie like, it takes a couple of steps and then stops. What do I need to do to keep it from stopping?


    Thanks.
     
  46. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Are they set to loop? Sounds like they are not.
     
  47. MandatoryDenial

    MandatoryDenial

    Joined:
    Jun 21, 2016
    Posts:
    20

    OMG do I feel dumb!!!! It never occurred to me to loop it since the Mechanim I have done has been trying to animate player characters. THANK YOU!!!
     
  48. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    eh... We all do dumb things once in a while. When you are replacing animations in a package like this it's always good to take a very close look at the animation you are replacing to make sure yours is set up the same. Even more critical if the system uses animation events!
     
  49. Adm94

    Adm94

    Joined:
    Jun 28, 2016
    Posts:
    1
    Hi,
    I have a little problem , I would like that my character have from the departure a usable weapon in his hand but I do not see how.
    Sorry for my bad english.
    Thanks.
     
  50. bluray467

    bluray467

    Joined:
    May 28, 2015
    Posts:
    15
    how do i make the combat faster and stuff like in metal gear rising?