void Combine()
    {
        if (_combiningIsPossible)
        {
            if (_combiningTimer <= 0)
            {
                _combiningIsPossible = false;

                GameObject combiningResult = CombiningEngine.instance.CombineIngredients(_leftGrabbable.combinable.Ingredient, _rightGrabbable.combinable.Ingredient);
                Orb        newOrb          = Instantiate(combiningResult, _combiningSpawnPosition.position, Quaternion.identity).GetComponent <Orb>();
                newOrb.Activate(CombiningSpawnAnchors.instance.GetRandomAnchor());

                _leftGrabbable.combinable.Combine();
                _rightGrabbable.combinable.Combine();

                _leftGrabbable          = null;
                _leftHandHasAttachment  = false;
                _rightGrabbable         = null;
                _rightHandHasAttachment = false;

                Instantiate(_combiningCompleteParticlesPrefab, _combiningSpawnPosition.position, Quaternion.identity);
                UpdateCombinables();
            }
            else
            {
                _combiningTimer -= Time.deltaTime;
            }
        }
    }
Exemple #2
0
    void SpawnOrb()
    {
        Orb newOrb = RetrieveOrbFromPool();

        newOrb.transform.position = transform.position;
        newOrb.Activate(_orbAnchors[Random.Range(0, _orbAnchors.Length)]);
        newOrb.OnDisabled += OrbWasDisabled;        //
        _orbsActive++;
    }