Invector

Discussion about Invector's assets


You are not connected. Please login or register

Welcome to the New vForum

View previous topic View next topic Go down  Message [Page 1 of 1]

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

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!

View user profile http://www.invector.xyz/

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

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);
            }
      }
   }
}

View user profile http://www.invector.xyz/

View previous topic View next topic Back to top  Message [Page 1 of 1]

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