void OnTriggerEnter2D(Collider2D otherObject) { if (currentState == groundState.Falling) { if (otherObject.gameObject == RayObject) { currentState = groundState.Static; gameObject.layer = 0; this.transform.position = new Vector3(RayObject.transform.position.x, RayObject.transform.position.y + GetComponent<BoxCollider2D>().bounds.size.y); GetComponent<BoxCollider2D>().isTrigger = false; } if (otherObject.tag == "LittleMen") { squashSFX.Play(); } } }
public void SetStateFalling() { Debug.Log("SetStateFalling()"); currentState = groundState.Falling; GetComponent<BoxCollider2D>().isTrigger = true; SetAboveFalling(); //UnityEditor.EditorApplication.isPaused = true; }