Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.7 kB
1
Indexable
Never
public class Objective : SerializedMonoBehaviour
{
    [Title("Debug Values")]
    bool abc; //This is here for dumb inspector reasons.
    [EnumToggleButtons]
    public enum ObjectiveState { Inactive, Active, Completed, Failed}
    [ReadOnly]
    public ObjectiveState objectiveState;

    [Title("Quest Settings")]
    public string objectiveName;
    [PropertySpace(SpaceBefore = 0, SpaceAfter = 10)]
    public string objectiveDescription;

    [EnumToggleButtons] //This could be a bool but having it as a enum looks really nice in Inspector.
    public enum ObjectiveType { Mandatory, Optional}
    public ObjectiveType objectiveType;
    [EnumToggleButtons] //This could be a bool but having it as a enum looks really nice in Inspector.
    public enum ObjectiveVisability { Visable, Hidden }
    public ObjectiveVisability objectiveVisability;

    [Space(10)]
    [SerializedDictionary("Objective, Objective State")]
    public SerializedDictionary<Objective, ObjectiveState> objectDict;


    public void EndObjective(ObjectiveState objState)
    {
        foreach (KeyValuePair<Objective,ObjectiveState> objDict in objectDict)
        {
            objDict.Key.objectiveState = objDict.Value;
            objDict.Key.ObjectiveStateChange();
        }
        objectiveState = objState;
        ObjectiveStateChange();
    }

    public void ObjectiveStateChange()
    {
        switch(objectiveState)
        {
            case ObjectiveState.Inactive:

                break;
            case ObjectiveState.Active:

                break;
            case ObjectiveState.Completed:

                break;
            case ObjectiveState.Failed:

                break;
        }
    }
}