public TType Get <TType>() where TType : class { var item = BlackBoards.Components.OfType <TType>().FirstOrDefault(); //?? StartingBlackBoardComponents.OfType<TType>().FirstOrDefault(); return(item ?? EcsComponent.CreateObject(typeof(TType)) as TType); }
/*-------------------------------------- * PUBLIC METHODS *------------------------------------*/ /// <summary>Adds a component to the entity.</summary> /// <param name="component">The component to add to the entity.</param> public void AddComponent(EcsComponent component) { mComponents.Add(component.GetType(), component); var scene = mScene; if (scene != null) { scene.NotifyComponentsChanged(this); } }
public void AddComponent(int id, EcsComponent component, Type type) { Components[type].Add(id, component); }
public static void Translate(EcsComponent component, float x, float y, float z) { component.transform.position += new Vector3(x, y, z); }
public static void TranslateWithTime(EcsComponent component, Vector3 direction) { component.transform.position += Time.deltaTime * direction; }
public void AddComponent(EcsComponent component) { mComponents.Add(component.GetType(), component); }