您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

31 行
1.1 KiB

using System.Collections;
using System.Collections.Generic;
using Unity.Entities;
using UnityEngine;
using UnityEngine.UI;
public class RocketLauncherUI : AbilityUI
{
public RawImage activeIcon;
public Text cooldownText;
public GameObject disabledOverlay;
public override void UpdateAbilityUI(EntityManager entityManager, ref GameTime time)
{
var state = entityManager.GetComponentData<Ability_ProjectileLauncher.PredictedState>(ability);
var settings = entityManager.GetComponentData<Ability_ProjectileLauncher.Settings>(ability);
activeIcon.enabled = state.phase == Ability_ProjectileLauncher.Phase.Active;
bool showCooldown = state.phase == Ability_ProjectileLauncher.Phase.Cooldown;
cooldownText.gameObject.SetActive(showCooldown);
disabledOverlay.SetActive(showCooldown);
if (showCooldown)
{
float cooldownLeft = settings.cooldownDuration - time.DurationSinceTick(state.phaseStartTick);
cooldownText.text = string.Format("{0:F1}", cooldownLeft);
}
}
}