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; } }
void Awake() { _blobBinder = GetComponentInChildren <BlobBinder>(); _rb = GetComponent <Rigidbody2D>(); _stampedeCount = 0; _vx = 0; _faceRight = false; }
void Awake() { _blobBinder = GetComponentInChildren<BlobBinder>(); _rb = GetComponent<Rigidbody2D>(); _stampedeCount = 0; _vx = 0; _faceRight = false; }
void Awake() { _newPosition = transform.position.AsVector2(); _oldPosition = _newPosition; _vely = 5*GRAVITY; _snap = GetComponent<SpiderSnap>(); _blobBinder = GetComponentInChildren<BlobBinder>(); _anim = GetComponentInChildren<Animator>(); }
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); } }
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); }
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); } }
void Awake() { _blobBinder = GetComponentInChildren <BlobBinder>(); _anim = GetComponentInChildren <Animator>(); _rb = GetComponent <Rigidbody2D>(); }
void Awake() { _newPosition = transform.position.AsVector2(); _oldPosition = _newPosition; _snap = GetComponent<MooseSnap>(); _heroDim = GetComponent<MooseDimensions>(); _blobBinder = GetComponentInChildren<BlobBinder>(); _anim = GetComponentInChildren<Animator>(); endSnap(false); }
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; } }