You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
583 B
24 lines
583 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Gamestrap
|
|
{
|
|
public abstract class ComponentModifier<T> : Modifier where T : Component
|
|
{
|
|
public T Component { get; set; }
|
|
|
|
public override void Apply(GameObject target)
|
|
{
|
|
Component = target.GetComponent<T>();
|
|
if (!Component)
|
|
{
|
|
Component = target.AddComponent<T>();
|
|
}
|
|
if (Component)
|
|
Apply(Component);
|
|
}
|
|
|
|
public abstract void Apply(T component);
|
|
}
|
|
}
|