private void OnInit(EntityUid uid, ArtifactComponent component, ComponentInit args)
 {
     if (component.RandomTrigger)
     {
         AddRandomTrigger(uid, component);
     }
 }
Example #2
0
        private void Update()
        {
            if (!cooldownComponent)
            {
                int id = uiArtifactCooldownComponent.id;
                ArtifactComponent artifactUsingComponent =
                    FindObjectsOfType <ArtifactComponent>().FirstOrDefault(x => x.id == id);
                if (artifactUsingComponent)
                {
                    cooldownComponent = artifactUsingComponent.gameObject.GetComponent <CooldownComponent>();
                }
                return;
            }

            var currentTime = Time.realtimeSinceStartup;

            float fill = 1;

            if (!cooldownComponent.canUse)
            {
                fill = (currentTime - cooldownComponent.last) / cooldownComponent.cooldown;
            }
            uiArtifactCooldownComponent.cooldownImage.fillAmount = fill;
        }