Ejemplo n.º 1
0
    private void FixedUpdate()
    {
        if (Time.time < nextDistanceCheck)
        {
            return;
        }

        distanceFromFlautist = Vector3.Distance(playerTransform.position, transform.position);
        if (follow)
        {
            distanceFromCaldron = Vector3.Distance(caldronTransform.position, transform.position);

            if (distanceFromCaldron < 1.2f)
            {
                follow = false;
                gameObject.SetActive(false);
                RemainsPool.PlayVfxOnPosition(transform.position);
                BoltsPool.PlayVfxOnPosition(transform.position);
                GameManager.Instance.ReplaceChild(this);
            }
            else if (distanceFromCaldron < GameManager.Instance.cauldronRange)
            {
                agent.stoppingDistance = 0;
                target = caldronTransform;
            }
        }

        nextDistanceCheck = Time.time + 0.2f;
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        if (instance != null)
        {
            if (instance != this)
            {
                DestroyImmediate(gameObject);
                return;
            }
        }

        instance = this;
    }