mirror of
https://github.com/hanzoai/ProjectTinySamples.git
synced 2026-09-24 00:01:34 +00:00
32 lines
812 B
C#
32 lines
812 B
C#
using Unity.Entities;
|
|
using Unity.Transforms;
|
|
|
|
namespace BlendShapeDemo
|
|
{
|
|
/// <summary>
|
|
/// Detect the selected character
|
|
/// </summary>
|
|
|
|
public class CharacterDetection : SystemBase
|
|
{
|
|
protected override void OnUpdate()
|
|
{
|
|
var game = GetSingleton<Game>();
|
|
|
|
Entities.ForEach((ref Entity entity, ref Tappable tappable, ref Character character, ref Translation translation) =>
|
|
{
|
|
if (game.gameState != GameState.Moving)
|
|
{
|
|
if (tappable.IsTapped)
|
|
{
|
|
character.selected = true;
|
|
}
|
|
}
|
|
|
|
tappable.IsTapped = false;
|
|
|
|
}).WithStructuralChanges().Run();
|
|
}
|
|
}
|
|
}
|