void OnCollisionStay(Collision other) { //和怪物接触后,减速 if (other.gameObject.tag == "OniGroup") { if (this.step != Step.Miss) { this.next_step = Step.Miss; //玩家和怪物接触时的处理 this.scene_control.OnPlayerMissed(); //记录下怪物组和玩家发生了接触 OniGroupControl oni_group = other.gameObject.GetComponent <OniGroupControl>(); oni_group.OnPlayerHitted(); } } //是否着陆了? if (other.gameObject.tag == "Floor") { is_runnig = true; } }
public void OnCollisionStay(Collision other) { if (other.gameObject.tag == "OniGroup") { do { if (this.attackTimer > 0.0f) { break; } if (this.step == STEP.MISS) { break; } this.next_step = STEP.MISS; this.scene_control.OnPlayerMissed(); OniGroupControl oniGroup = other.gameObject.GetComponent <OniGroupControl>(); oniGroup.OnPlayerHitted(); } while (false); } if (other.gameObject.tag == "Floor") { if (other.relativeVelocity.y >= Physics.gravity.y * Time.deltaTime) { this.is_contact_floor = true; } } }