Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        var list = new List <Transform>();

        list.Add(PlayerCharacter);
        if (Progress.Instance.GetProgressFlagState(PineConesFlag) >= PineCones.Length)
        {
            list.Add(Dad);
        }
        else
        {
            foreach (var pineCone in PineCones)
            {
                if (pineCone &&
                    (VectorMath.Flatten(pineCone.position) -
                     VectorMath.Flatten(PlayerCharacter.position)).sqrMagnitude <
                    DistanceToShowPineCone * DistanceToShowPineCone)
                {
                    list.Add(pineCone);
                }
            }
        }

        syncCameraGroup.Targets = list.ToArray();
    }
 private bool IsTooFarAway(Transform target)
 {
     return((
                VectorMath.Flatten(target.position) -
                VectorMath.Flatten(PlayerCharacter.position)
                ).sqrMagnitude > MaxDistance * MaxDistance);
 }
    // Update is called once per frame
    void Update()
    {
        var list = new List <Transform>();

        list.Add(PlayerCharacter);
        if (Progress.Instance.GetProgressFlagState(TalkToMomFlag) == 0 ||
            Progress.Instance.GetProgressFlagState(RaspberriesFlag) >= Raspberries.Length)
        {
            list.Add(Mom);
        }
        else
        {
            foreach (var raspberries in Raspberries)
            {
                if (raspberries &&
                    (VectorMath.Flatten(raspberries.position) -
                     VectorMath.Flatten(PlayerCharacter.position)).sqrMagnitude <
                    DistanceToShowRaspberry * DistanceToShowRaspberry)
                {
                    list.Add(raspberries);
                }
            }
        }

        syncCameraGroup.Targets = list.ToArray();
    }
Exemple #4
0
    private void Detach(GameObject g)
    {
        currentVolume -= collected.Last.Value.GetComponent <Stats>().GetVolume() * growthFactor;

        g.GetComponent <SphereCollider>().enabled = true;
        g.GetComponent <MeshCollider>().enabled   = true;
        g.GetComponent <Rigidbody>().isKinematic  = false;
        collected.Remove(g);
        colliders.Remove(g);
        collisions.Remove(g);
        g.transform.parent = null;
        g.GetComponent <Rigidbody>().velocity +=
            VectorMath.Flatten(g.transform.position - gameObject.transform.position) +
            3 * Vector3.up;
    }
    void Update()
    {
        var list = new List <Transform>();

        list.Add(PlayerCharacter);

        foreach (var target in TraditionTriggers)
        {
            if (target &&
                (VectorMath.Flatten(target.position) -
                 VectorMath.Flatten(PlayerCharacter.position)).sqrMagnitude <
                DistanceToShow * DistanceToShow)
            {
                list.Add(target);
            }
        }

        syncCameraGroup.Targets = list.ToArray();
    }