コード例 #1
0
ファイル: GridService.cs プロジェクト: Chezzyz/FactoryTycoon
    private void SpawnTrash(SlotController slot)
    {
        var trashGo  = UnityEngine.Object.Instantiate(_trashPrefab, slot.transform);
        var newTrash = trashGo.GetComponent <TrashController>();

        var typeCount = Enum.GetNames(typeof(TrashType)).Length;

        newTrash.InitService((TrashType)UnityEngine.Random.Range(0, typeCount));
        newTrash.InitView();

        slot.SetItemController(newTrash);
    }