BehaviorTree / Runtime / Attributes / PortAttribute.cs
PortAttribute.cs
Raw
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor.Experimental.GraphView;
using UnityEngine;

namespace AI.BT
{
    [AttributeUsage(AttributeTargets.All, Inherited = true, AllowMultiple = true)]
    public abstract class PortAttribute : Attribute
    {
        public abstract Direction Direction { get; }

        public Port.Capacity Capacity { get; }

        public Type Type { get; }

        public PortAttribute(Port.Capacity capacity, Type type)
        {
            Capacity = capacity;
            Type = type;
        }
    }

    public class PortOutputAttribute : PortAttribute
    {
        public override Direction Direction => Direction.Output;

        public PortOutputAttribute(Port.Capacity capacity, Type type) :base(capacity, type){ }
    }

    public class PortInputAttribute : PortAttribute
    {
        public override Direction Direction => Direction.Input;

        public PortInputAttribute(Port.Capacity capacity, Type type) : base(capacity, type) { }
    }
}