Пример #1
0
    // Start is called before the first frame update
    void Awake()
    {
        lootManager = GameObject.FindGameObjectWithTag("LootManager").GetComponent <LootManager>();
        lootBox     = GameObject.FindGameObjectWithTag("LootBoxIcon");
        animate     = GameObject.FindGameObjectWithTag("LootBoxIcon").GetComponent <Animator>();
        UI          = GameObject.FindGameObjectWithTag("lootUI").GetComponent <LootHistoryUIManager>();

        if (Random.Range(0, 100) <= 90)
        {
            weapon = lootManager.LootToDrop();
            Instantiate(weapon.prefab, this.gameObject.transform);
            meshRenderer = GetComponentInChildren <MeshRenderer>();
            rb           = GetComponentInChildren <Rigidbody>();
            Drop();
        }
        else
        {
            Destroy(this.gameObject);
        }
    }