Hello!
I am trying to call the public function, damage() in the script below, however SendMessage action takes only one parameter, and I think InvokeMethod action does not even allow parameters (NOTE: PM says it is fine, but errors in the unity console)?
using UnityEngine;
using System.Collections;
public class PAClass : MonoBehaviour {
public int HP = 100;
public float multDark = 0.75f;
public float multLight = 0.25f;
public void damage(int damageDark, int damageLight)
{
float currentDamage = ((float)damageDark * multDark) + ((float)damageLight * multLight);
HP -= (int)Mathf.Floor(currentDamage);
print ("Damaged by: " + currentDamage);
if (HP <= 0)
{
print ("I am dead!");
Destroy(this.gameObject);
}
}
public void testDamage(int damage)
{
HP -= damage;
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
There is another function, testDamage in the code that works fine with the SendMessage action. Do I need to create a custom action perhaps?
Thanks!