Beispiel #1
0
    void Update()
    {
        if (_currentlyBuilding && _itemToBuild != null)
        {
            if (_buildSecondsRemaining > 0)
            {
                _buildSecondsRemaining -= Time.deltaTime;
            }
            else
            {
                //Finished building
                _currentlyBuilding = false;

                //Stop particles
                SetBuildEffectsEnabled(false);

                //Stop animation
                Debug.Log("Finished Building");

                //Generate new item.
                GameObject newItem = GameObject.Instantiate(_itemToBuild.inGamePrefab, Vector3.zero, Quaternion.identity);

                //Snap new object to snapzone
                _snapZone.GrabGrabbable(newItem.GetComponent <Grabbable>());
            }
        }
    }