using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LevelChosse : MonoBehaviour {
public GameObject toggleGroups;
IEnumerable<Toggle> toggleGroup;
void Update () {
if (toggleGroup!=null)
{
toggleGroup = toggleGroups.GetComponent<ToggleGroup>().ActiveToggles();
foreach (Toggle to in toggleGroup)
{
if (to.isOn)
{
switch (to.name)
{
case "Toggle_Easy":
CollisonTest.Damage = 5;
break;
case "Toggle_normal":
CollisonTest.Damage = 10;
break;
case "ToggleP_diffcult":
CollisonTest.Damage = 20;
break;
}
break;
}
}
}
}
}
通过ToggleGroup实现关卡难度的选择
最新推荐文章于 2024-09-14 11:45:00 发布