public override IEnumerator StartAnimation(VEntity entity, Action yieldAnimation) { EntityAppearEvent appearEvent = VEntityComponentSystemManager.GetVComponent <EntityAppearEvent>(entity); var unitEntity = ecsManager.GetVEntityById(appearEvent.entityId); var unitDisplay = VEntityComponentSystemManager.GetVComponent <UnitDisplayComponent>(unitEntity); VEntityComponentSystemManager.GetVComponent <UnitDisplayComponent>(unitEntity).unitDisplayGameObject.gameObject.SetActive(true); unitDisplay.unitDisplayGameObject.transform.position = unitEntity.GetVComponent <PositionDisplayComponent>().mainTransform.position; unitDisplay.spriteSize = ecsManager.GetSystem <PositionWorldConversionSystem>().SquareDimensions; unitDisplay.unitDisplayGameObject.BindEntity(unitEntity); unitDisplay.unitDisplayGameObject.ResizeSprite(unitDisplay.spriteSize); unitDisplay.getTransform().SetParent(unitEntity.GetVComponent <PositionDisplayComponent>().mainTransform); yield return(new WaitForSeconds(0.1f)); yieldAnimation(); }
public override bool ShouldOperate(VEntity entity) { EntityAppearEvent e = entity.GetVComponent <EntityAppearEvent>(); return(e != null && (ecsManager.GetVEntityById(e.entityId).GetVComponent <UnitDisplayComponent>() != null)); }