/// <summary> /// 初期化 /// </summary> public void Initialize() { isDead = false; deadCause = DokanSet.Type.None; rigidbody2D.isKinematic = true; transform.position = new Vector3(-0.885f, 0.501f, 0f); transform.rotation = Quaternion.identity; lastJump = float.MinValue; StopCoroutine("DeadCotourine"); Animator anim = GetComponent<Animator>(); if (anim != null) { anim.Play("idle"); anim.enabled = true; } }
void OnTriggerEnter2D(Collider2D collider) { // Debug.Log("OnTriggerEnter2D : " + collider.name); if (collider.tag.Equals("danger")) { if (isDead==false) { // 死因 deadCause = GetDeadCause(collider.gameObject); // 死亡 Dead(); } } }
/// <summary> /// 主に地面との接触 /// </summary> void OnCollisionEnter2D(Collision2D coll) { // Debug.Log("OnCollisionEnter2D : " + coll.gameObject.name + " " + coll.gameObject.tag); if (coll.gameObject.tag.Equals("danger")) { if (isDead==false) { // 死因 deadCause = GetDeadCause(coll.gameObject); // 死亡 Dead(); } } }