示例#1
0
        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();
        }
示例#2
0
        public override bool ShouldOperate(VEntity entity)
        {
            EntityAppearEvent e = entity.GetVComponent <EntityAppearEvent>();

            return(e != null && (ecsManager.GetVEntityById(e.entityId).GetVComponent <UnitDisplayComponent>() != null));
        }