示例#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;
    }
示例#2
0
文件: BoltsPool.cs 项目: Hengle/LD43
    private void Awake()
    {
        if (instance != null)
        {
            if (instance != this)
            {
                DestroyImmediate(gameObject);
                return;
            }
        }

        instance = this;
    }