public void Activate(string wallDirStr) { InUse = true; foreach (Tween tw in tweensToKill) { tw?.Kill(); } bool dir_is_R = wallDirStr == "r"; transform.position = HeroDefiner.CurrentPos + new Vector3( dir_is_R ? positionFromHero.x : -positionFromHero.x, positionFromHero.y, positionFromHero.z ); transform.localScale = new Vector3(dir_is_R ? 1 : -1, 1, 1); spriteRenderer.color = new Color(1, 1, 1, 1); anim.Play(() => { tweensToKill[0] = transform.DOMoveY(100, 0.5f).SetRelative().AsHeros(); tweensToKill[1] = spriteRenderer.DOFade(0, 0.5f).AsHeros(); tweensToKill[2] = DOVirtual.DelayedCall(0.5f, () => { gameObject.SetActive(false); InUse = false; }, ignoreTimeScale: false).AsHeros(); }); }
public void Init(bool toRight) { if (!toRight) { transform.localScale = new Vector3(-1, 1, 1); } anim.Play(() => Destroy(gameObject)); }
public void Spawn() { gameObject.SetActive(true); heroSensor.OnTriggerEnter2DAsObservable() .Where(other => other.CompareTag(Tags.Hero)) .Take(1) .Subscribe(_ => Jump(HeroDefiner.CurrentPos)) .AddTo(this); anim.Play(); }