So I am trying to create a system where I have a Player as a main gameObject that is enriched with functionality provided by an attached script component. so a player would have a movement Component and a selector component, health, inventory etc…
At the moment I am creating the AbilityComponent. I would like this to be a script containing an array of ability objects. I would figure that my ability object would inherit from monobehaviour. other classes (concrete implementations of abilities e.g fireball) would inherit from Ability. So that in my ability component I would be able to create a list in the unity editor by dragging and dropping spell scripts into the array of Abilities.
My Ability Class:
using UnityEngine;
using System.Collections;
public class Ability : MonoBehaviour{
void Start(){
Debug.Log ("I AM A SPELL");
}
}
My concrete “Fireball” class:
using UnityEngine;
using System.Collections;
public class FireBall : Ability {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
My abilityComponent:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[System.Serializable]
public class AbilityComponent : MonoBehaviour {
public Ability [] abilities;
}
What I want to do:
,

