Invector
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Invector

Discussion about Invector's assets


You are not connected. Please login or register

Welcome to the New vForum

Go down  Message [Page 1 of 1]

1Welcome to the New vForum Empty Welcome to the New vForum Mon Jul 18, 2016 11:01 pm

Invector

Invector
Admin

Welcome to the new vForum guys!

Here we can discuss better about the 3rd Person Controller Templates, learn and share new stuff and also show your work!
Please use the Search tool before posting your questions.
Here is some tips to use this forum:

Code:

 public class VinvectorbridgeStats
    {
        [Tooltip("Invector current health this should be left as is")]
        public float Vcurrent_health; // get health from Vector third person controller
        [Tooltip("Invector current Stamina this should be left as is")]
        public float Vcurrent_stamina; // get stamina from vector third person controller
        [Tooltip("Invector Max Health this should be left as is")]
        public float VMaxhealth;
        [Tooltip("Invector Max Stamina this should be left as is")]
        public float VMaxstamina;
    }

Testing lol!

http://www.invector.xyz/

2Welcome to the New vForum Empty Re: Welcome to the New vForum Tue Jul 19, 2016 12:09 pm

Invector

Invector
Admin

Code:

using UnityEngine;
using System.Collections;
using Invector;

public class vHealthItem : MonoBehaviour
{
    [Tooltip("How much health will be recovery")]
   public float value;
   
   void OnTriggerEnter(Collider other)
   {
      if(other.gameObject.tag.Equals("Player"))
      {           
            // access the basic character information
         var iChar = other.GetComponent<vCharacter>();
            // apply value plus the current health
         var targetHealth = iChar.currentHealth + value;
            // heal only if the character's health isn't full           
         if(iChar.currentHealth < iChar.maxHealth)
         {
                // limit healing to the max health
                iChar.currentHealth = Mathf.Clamp(targetHealth, 0, iChar.maxHealth);
            Destroy(gameObject);   
         }
            else
            {               
                // show message if the character's health is full
                other.SendMessage("ShowText", "Health is Full", SendMessageOptions.DontRequireReceiver);
            }
      }
   }
}

http://www.invector.xyz/

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum