void Update() { if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D)) { playerManager.StepsTaken++; Vector3 OldPos = transform.position; MovePos(); if (OldPos != transform.position) { if (StandingTile.ToggleType) { PressurePlate pressurePlate = StandingTile.GetComponent <PressurePlate>(); pressurePlate.ToggleState(); } else if (StandingTile.SpikeType) { SpikeTile spike = StandingTile.GetComponent <SpikeTile>(); if (spike.State) { playerManager.GetHurt(); } } else if (StandingTile.KeyType) { KeyTile key = StandingTile.GetComponent <KeyTile>(); TotalKeys = key.ToggleState(TotalKeys); } else if (StandingTile.ChestType) { LockedChest chest = StandingTile.GetComponent <LockedChest>(); TotalKeys = chest.ToggleState(TotalKeys); } else if (StandingTile.EndType) { EndTile Finish = StandingTile.GetComponent <EndTile>(); Finish.ToggleState(); MyFiredArrows?.Invoke(); } } } }