void SpawnShipWeaponIcon() { Canvas canvas = GameManager.ins.GetCopyOfCanvas("ShipWeaponIcons"); float y = 0; shipWeaponSelectables = new ShipWeaponSelectableIcon[boss.AttackTypes.Length]; for (int i = 0; i < boss.AttackTypes.Length; i++) { Boss.AttackType _type = boss.AttackTypes[i]; RectTransform newIconT = Instantiate(iconPrefab, canvas.transform).GetComponent <RectTransform>(); Vector3 pos = newIconT.anchoredPosition; pos.y = y; newIconT.anchoredPosition = pos; y += 80; newIconT.GetComponentInChildren <TextMeshProUGUI>().text = (boss.AttackTypes.Length - i).ToString(); newIconT.GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>("Image/Icon/" + _type.ToString()); ShipWeaponSelectableIcon current = shipWeaponSelectables[i] = newIconT.GetComponent <ShipWeaponSelectableIcon>(); current.Setup(this, _type); if (i > 0) { shipWeaponSelectables[i - 1].NavTop = shipWeaponSelectables[i]; shipWeaponSelectables[i].NavBottom = shipWeaponSelectables[i - 1]; } } selected = shipWeaponSelectables[shipWeaponSelectables.Length - 1]; selected.Selected = true; }
public void ActiveWeapon(SelectableItem selectable, Boss.AttackType type) { if (!selectable.Disabled && !selectable.Active && boss.Idling) { selectable.Active = true; boss.NewAttack(type); } }
private void WeaponAvalible(Boss.AttackType _type) { for (int i = 0; i < shipWeaponSelectables.Length; i++) { if (shipWeaponSelectables[i].Type == _type) { shipWeaponSelectables[i].Disabled = false; } } }
private void WeaponFinished(Boss.AttackType _type) { for (int i = 0; i < shipWeaponSelectables.Length; i++) { if (shipWeaponSelectables[i].Type == _type) { shipWeaponSelectables[i].Active = false; shipWeaponSelectables[i].Disabled = true; } } }
public void Setup(BossInput _input, Boss.AttackType _type) { type = _type; input = _input; }