_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/RacingPanel/ToolsManager.cs

42 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ToolsManager : MonoBehaviour
{
public static ToolsManager instance;
public List<snailRiderItem> tools=new List<snailRiderItem>();
// Start is called before the first frame update
void Start()
{
instance = this;
ShowTools();
RamgeTools();
}
public void RamgeTools()//随机道具位置和属性
{
foreach (snailRiderItem tool in tools)
{
int type = Random.Range(0, 2);
float randPosX= Random.Range(-350, 300);
tool.transform.position = new Vector2(tool.transform.position.x + randPosX, tool.transform.position.y);
if (type==0)
{
tool.mode = snailRiderItem.Mode.accelerate;
}
else
{
tool.mode = snailRiderItem.Mode.slowDown;
}
}
}
public void ShowTools()//显示所有道具
{
foreach (snailRiderItem tool in tools)
{
tool.gameObject.SetActive(true);
}
}
}