多选状态切换>>多个选项中选一个,选中状态的切换
GameObject lastSelect;//上一次选中
public void OnCharacterClick(GameObject currSelect)
{
if (lastSelect && currSelect == lastSelect)//当前选择和上一次相同不做处理
{
return;
}
iTween.ScaleTo(currSelect,Vector3.one *2,0.5f); //把选中物体放大2倍
if (lastSelect)//把上一次物体缩小,如果有的话
{
iTween.ScaleTo(currSelect,Vector3.one,0.5f);
}
lastSelect = currSelect;//当前选中保存到上一次选中变量中
}