Example #1
0
 void Start()
 {
     heroXP = GameObject.Find("Hero").GetComponent<ExperienceReceiver>();
     if (!heroXP)
         Debug.Log("HeroXP not found");
     XPBarImage = GetComponent<Image>();
 }
Example #2
0
 // Use this for initialization
 void Start()
 {
     text = GetComponent<Text>();
     heroXP = GameObject.Find("Hero").GetComponent<ExperienceReceiver>();
     if (!heroXP)
         Debug.Log("HeroXP not found");
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     text   = GetComponent <Text>();
     heroXP = GameObject.Find("Hero").GetComponent <ExperienceReceiver>();
     if (!heroXP)
     {
         Debug.Log("HeroXP not found");
     }
 }
Example #4
0
 void Start()
 {
     heroXP = GameObject.Find("Hero").GetComponent <ExperienceReceiver>();
     if (!heroXP)
     {
         Debug.Log("HeroXP not found");
     }
     XPBarImage = GetComponent <Image>();
 }
Example #5
0
    public void die(GameObject killer)
    {
        if (!killer)    // If the killer is dead, no need to give xp
        {
            return;
        }
        ExperienceReceiver xpReceiver = killer.GetComponent <ExperienceReceiver>();

        if (xpReceiver)     // if the killer receives experience, give it
        {
            xpReceiver.addXP(experience);
            FloatingText xpText = (Instantiate(floatingText) as GameObject).GetComponent <FloatingText>();
            xpText.initialize(gameObject, "+" + experience + "xp");
            xpText.setColor(Color.yellow);
        }
    }