Ejemplo n.º 1
0
    void LateUpdate()
    {
        if (!_globbing)
        {
            if (_binder)
            {
                transform.position = _binder.Target.transform.position;
            }
            return;
        }
        _t += Time.deltaTime * 2;

        if (_oldBinder == null || _t >= 1)
        {
            _binder.HasBlob    = true;
            transform.position = _binder.Target.transform.position;
            _globbing          = false;
            _oldBinder         = null;
        }
        else
        {
            var t = damp(_t);
            transform.position = _oldBinder.Target.transform.position + (_binder.Target.transform.position - _oldBinder.Target.transform.position) * t;
        }
    }
Ejemplo n.º 2
0
 void Awake()
 {
     _blobBinder    = GetComponentInChildren <BlobBinder>();
     _rb            = GetComponent <Rigidbody2D>();
     _stampedeCount = 0;
     _vx            = 0;
     _faceRight     = false;
 }
Ejemplo n.º 3
0
 void Awake()
 {
     _blobBinder = GetComponentInChildren<BlobBinder>();
     _rb = GetComponent<Rigidbody2D>();
     _stampedeCount = 0;
     _vx = 0;
     _faceRight = false;
 }
Ejemplo n.º 4
0
    void Awake()
    {
        _newPosition = transform.position.AsVector2();
        _oldPosition = _newPosition;
        _vely = 5*GRAVITY;

        _snap = GetComponent<SpiderSnap>();
        _blobBinder = GetComponentInChildren<BlobBinder>();
        _anim = GetComponentInChildren<Animator>();
    }
Ejemplo n.º 5
0
    void bindTo(BlobBinder binder)
    {
        if (binder == null) return;
        if (_binder) {
            _binder.HasBlob = false;
            _oldBinder = _binder;
        }

        _binder = binder;
        binder.BlobRef = this;
        _globbing = true;
        _t = 0;

        if (MusicController.Instance) {
            MusicController.Instance.SetMusic(_binder.MusicIndex);
        }
    }
Ejemplo n.º 6
0
    BlobBinder getClosestBinder()
    {
        float      closestDist   = float.MaxValue;
        BlobBinder closestBinder = null;

        foreach (var binder in FindObjectsOfType <BlobBinder>())
        {
            if (binder.HasBlob)
            {
                continue;
            }
            var d2 = (binder.Target.transform.position.WithZ(0) - transform.position.WithZ(0)).sqrMagnitude;
            if (d2 < closestDist)
            {
                closestDist   = d2;
                closestBinder = binder;
            }
        }

        return(closestDist < BindRange * BindRange ? closestBinder : null);
    }
Ejemplo n.º 7
0
    void bindTo(BlobBinder binder)
    {
        if (binder == null)
        {
            return;
        }
        if (_binder)
        {
            _binder.HasBlob = false;
            _oldBinder      = _binder;
        }

        _binder        = binder;
        binder.BlobRef = this;
        _globbing      = true;
        _t             = 0;

        if (MusicController.Instance)
        {
            MusicController.Instance.SetMusic(_binder.MusicIndex);
        }
    }
Ejemplo n.º 8
0
 void Awake()
 {
     _blobBinder = GetComponentInChildren <BlobBinder>();
     _anim       = GetComponentInChildren <Animator>();
     _rb         = GetComponent <Rigidbody2D>();
 }
Ejemplo n.º 9
0
    void Awake()
    {
        _newPosition = transform.position.AsVector2();
        _oldPosition = _newPosition;

        _snap = GetComponent<MooseSnap>();
        _heroDim = GetComponent<MooseDimensions>();
        _blobBinder = GetComponentInChildren<BlobBinder>();
        _anim = GetComponentInChildren<Animator>();

        endSnap(false);
    }
Ejemplo n.º 10
0
    void LateUpdate()
    {
        if (!_globbing) {
            if (_binder) transform.position = _binder.Target.transform.position;
            return;
        }
        _t += Time.deltaTime * 2;

        if (_oldBinder == null || _t >= 1) {
            _binder.HasBlob = true;
            transform.position = _binder.Target.transform.position;
            _globbing = false;
            _oldBinder = null;
        } else {
            var t = damp(_t);
            transform.position = _oldBinder.Target.transform.position + (_binder.Target.transform.position - _oldBinder.Target.transform.position) * t;
        }
    }