public void Init_Server(EnemyData data) { if (entity.IsOwner()) { _data = data; state.Health = data.health; _health = new SKU.ResourceAttribute(_data.health, _data.health, 1, 0.5f); _health.AddOnValueChangedListener(UpdateHealth_Server); AttributeManager attributeManager = gameObject.AddComponent <AttributeManager>(); attributeManager.Add(AttributeType.Health, _health); var movement = gameObject.AddComponent <EnemyMovement>(); movement.Init_Server(_data.speed); } }
void UpdateHealth_Server(SKU.ResourceAttribute attribute) { state.Health = attribute.Value; state.HealthMax = attribute.Max.Value; }