コード例 #1
0
        void HandleDamage(GameObject obj, int amount)
        {
            Damageable dam = obj.GetComponent <Damageable>();

            if (obj.gameObject.name == "Player")
            {
                app.NotifyAnimation(AnimationMessage.TRIGGER, obj, "damage");
            }

            if (dam)
            {
                dam.ChangeHealth(-amount);
            }
            else
            {
                Debug.Log(obj.name + " was scheduled for damage calculations but doesn't have a damageable component.");
            }
        }
コード例 #2
0
        void HandleHeal(GameObject obj)
        {
            Damageable heal = obj.GetComponent <Damageable>();

            heal.SetHealth(3);
        }