// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.F1)) { _gcContainer.Init(MaxGhosts, SpawnRate, _srSpriteRenderer, EffectDuration, GhostTintColor); //initiate the ghosting routine } if (Input.GetKeyDown(KeyCode.F2)) { _gcContainer.StopEffect(); } if (Input.GetKeyDown(KeyCode.F3)) { transform.position = _originalpos; } transform.position += (Speed * Time.deltaTime) * Vector3.right; }
//dashing private void Dash(float x, float y) { Camera.main.transform.DOComplete(); Camera.main.transform.DOShakePosition(.2f, .5f, 14, 90, false, true); hasdashed = true; anim.SetTrigger("dash"); gh.Init(20, 0.01f, sr, 1f); rb.velocity = Vector2.zero; Vector2 dir = new Vector2(x, y); rb.velocity += dir.normalized * dashspeed; StartCoroutine(DashWait()); }