public override void DoImmediateAnimation(VEntity entity) { HealthSetAnimationEvent healthSetEvent = entity.GetVComponent <HealthSetAnimationEvent>(); VEntity targetEntity = ecsManager.GetVEntityByIdIncludingRemoved(healthSetEvent.targetEntity); HealthDisplayComponent healthDisplay = targetEntity.GetVComponent <HealthDisplayComponent>(); if (healthDisplay != null) { healthDisplay.healthBarDisplay.SetValue(healthSetEvent.currHealth); } }
public override void DoImmediateAnimation(VEntity entity) { VEntity targetEntity = ecsManager.GetVEntityByIdIncludingRemoved(entity.GetVComponent <EntityAppearEvent>().entityId); HealthDisplayComponent healthDisplay = ecsManager.GetVEntityById(entity.GetVComponent <EntityAppearEvent>().entityId).GetVComponent <HealthDisplayComponent>(); healthDisplay.healthBarDisplay = HealthBarDisplay.Instantiate(healthBarDisplayPrefab); HealthComponent h = targetEntity.GetVComponent <HealthComponent>(); Assert.IsNotNull(h); healthDisplay.healthBarDisplay.Init(h.maxHealth); healthDisplay.healthBarDisplay.SetValue(h.currHealth); var positionDisplay = targetEntity.GetVComponent <PositionDisplayComponent>(); healthDisplay.healthBarDisplay.transform.position = positionDisplay.mainTransform.position; healthDisplay.healthBarDisplay.transform.SetParent(positionDisplay.mainTransform); }