Releases: PixeyeHQ/actors.unity
Releases · PixeyeHQ/actors.unity
Actors Framework
2019.03.09 Hot fix
Actors Framework
Fix -> Added frame delay before adding entity to a group
Actors Framework
2018.03.07c Update
Actors Framework
2019.03.07b Update
Actors Framework
2019.03.07a Update
ACTORS framework
2019.02.24 Update
ACTORS framework
2019.02.23 Update
ACTORS framework
2019.02.22 Update README.md
ACTORS framework
- Group events changed:
Add instead Added
Remove instead Removed - Factory workflow changed. Added Default Factory Singleton
- New methods included in Framework Extensions:
Every - to iterate variables each x steps ( frames )
Plus, Minus - to calculate values with a clamp to min/max size.
if ((cReload.timer = cReload.timer.Minus(delta)) == 0)
cWeapon.clip = cWeapon.weapon.clipSize;
- Tags moved from common folder to [1]Source
- ComponentRelease and ProcessingRelease added. These scripts control entity destroying flow.
If you need to destroy entity use
entity.Release();
If entity is an actor use
entity.Release(true);
- Several components can be taken from the entity by once
// example
ComponentMotion cMotion;
ComponentPlayer cPlayer;
ComponentView cView;
if (entity.Get(out cMotion, out cPlayer, out cView))
{
}
ACTORS framework
Changes
Groups
Previously groups worked with entity index taken from a group. Now all groups correspond to entity directly.
This lead to several changes in code:
- Events such as Group.OnAdd/OnRemove listen to the entity, not the group index.
- Use foreach to iterate through entities in groups:
foreach (var entity in groupMotion)
{
var cMotion = entity.ComponentMotion();
var cRigid = entity.ComponentRigidBody();
var cBounds = entity.ComponentBounds();
var pos = cRigid.body.position;
pos += cMotion.stepFixed;
pos.x = Mathf.Clamp(pos.x, cBounds.limitation.min.x, cBounds.limitation.max.x);
pos.y = Mathf.Clamp(pos.y, cBounds.limitation.min.y, cBounds.limitation.max.y);
cRigid.body.MovePosition(pos);
}
Components
To use components directly from entities you will have to write some extension methods to a component script:
[Serializable]
public class ComponentMotion : IComponent
{
public TemplateMotion template;
[FoldoutGroup("Debug")] public float speedActual;
[FoldoutGroup("Debug")] public Vector2 direction;
[FoldoutGroup("Debug")] public Vector2 step;
[FoldoutGroup("Debug")] public Vector2 stepFixed;
[HideInInspector] public float speedOverride = 1;
}
// The extension methods pattern you will need to add to each component.
public static partial class Game
{
public static ComponentMotion ComponentMotion(this int entity)
{
return Storage<ComponentMotion>.Instance.components[entity];
}
public static bool TryGetComponentMotion(this int entity, out ComponentMotion component)
{
component = Storage<ComponentMotion>.Instance.TryGet(entity);
return component != null;
}
}