2 using System.Collections;
3 using System.Collections.Generic;
5 using UnityEngine.Tilemaps;
7 public class Stamping : MonoBehaviour
9 MouseController mouseController;
13 private float stampingSpeed = 40;
16 GameObject groundCheck;
19 GameObject dustEffect;
21 private bool isStamping = false;
23 // Start is called before the first frame update
26 mouseController = GetComponent<MouseController>();
27 rb = GetComponent<Rigidbody2D>();
30 // Update is called once per frame
33 if (!mouseController.isGrounded)
35 if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow))
38 rb.velocity = Vector2.down * stampingSpeed;
41 else if (mouseController.isGrounded && isStamping)
44 Vector3 spawnPos = new Vector3(groundCheck.transform.position.x, groundCheck.transform.position.y + 1, groundCheck.transform.position.z);
45 Instantiate(dustEffect, spawnPos, Quaternion.identity);
50 private void OnCollisionEnter2D(Collision2D collision)
52 if (collision.gameObject.CompareTag("Stamp") && isStamping)
54 collision.gameObject.SetActive(false);