void dualshock_1_listener() { string joystick_1 = "joystick 1 "; if (Input.GetKeyDown(joystick_1 + "button 4")) { Debug.Log("Revive! joystick 1"); p2mm.request_revive(); pmm.request_revive(); } if (Input.GetKeyDown(KeyCode.Q)) { pmm.request_death(); } if (Input.GetKeyDown(KeyCode.Z)) { pmm.request_landing(); } //////////////////////////////////// if (Input.GetKey(joystick_1 + "button 0")) { pmm.request_jab(); } float x_axis = Input.GetAxis("HorizontalP1"); //////////////////////////////////// if (x_axis < -0.5) { pmm.request_run_left(); } //pmm.request_run_left(); if (x_axis > -0.5 && x_axis < 0.5) { pmm.request_stop_running(); } ///////////////////////////////////// if (x_axis > 0.5) { pmm.request_run_right(); } /////////////////////////////////////// if (Input.GetKeyDown(joystick_1 + "button 1")) { pmm.request_jump(); } /////////////////////////////////////// if (Input.GetKeyDown(joystick_1 + "button 5")) { pmm.request_reset_position(); } }
void OnCollisionEnter(Collision col) { List <string> collision_collider_names = new List <string>(); for (int i = 0; i < col.contacts.Length; i++) { if ( (col.contacts [i].thisCollider.enabled) && (col.contacts[i].thisCollider.name == gameObject.name) && !collision_collider_names.Contains(col.collider.name) ) { Debug.Log("Grav RB Colliding with " + col.collider.name); if (col.collider.name == "left_hand") { this.GetComponent <PlayerMovementManager>().request_death(); Animator other_animator = col.collider.transform.parent.parent.GetComponent <Animator> (); Physics.IgnoreCollision(grav_collider, col.collider.transform.parent.parent.parent.GetComponent <BoxCollider> ()); if (!animator.GetCurrentAnimatorStateInfo(PlayerAnimatorStates.default_anim_layer_index).IsName(PlayerAnimatorStates.death_state_id)) { if (other_animator.GetBool(PlayerAnimatorParameters.is_facing_left)) { Instantiate(explosion_particles, col.contacts[i].point, Quaternion.Euler(new Vector3(0, 0, 90))); } ; if (other_animator.GetBool(PlayerAnimatorParameters.is_facing_right)) { Instantiate(explosion_particles, col.contacts[i].point, Quaternion.Euler(new Vector3(0, 0, -90))); } ; } } if (col.collider.name == "OutOfBounds") { p_sound_m.play_out_of_bounds_fx(); p_score_m.decrement_score(); pmm.request_reset_position(); } collision_collider_names.Add(col.collider.name); } } pmm.request_landing(); }