private void Start() { if (this.gameObject.CompareTag("Player1")) { _Player1CurrentState = Player1State.Solid; } else if (this.gameObject.CompareTag("Player2")) { _Player2CurrentState = Player2State.Fire; } _OriginalCapsuleHeight = _CC.height; }
public void Player2AirMovement(Player2State p2) { if (this.gameObject.tag == "Player2") { if (p2 == Player2State.Fire) { _Rb.velocity = new Vector3(Device.Direction.X * _AirSpeed, _Rb.velocity.y); if (Device.Direction.X >= 0.01) { this.gameObject.transform.rotation = Quaternion.Euler(0f, 90f, 0f); _SecondStateObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f); } else if (Device.Direction.X <= -0.01) { this.gameObject.transform.rotation = Quaternion.Euler(0f, 270f, 0f); _SecondStateObject.transform.rotation = Quaternion.Euler(0f, -180f, 0f); } } } }
public void Player2Movement(Player2State p2) { if (this.gameObject.tag == "Player2") { if (p2 == Player2State.Fire) { var _BoxCollider = GetComponent <BoxCollider>(); _BoxCollider.enabled = true; _Rb.velocity = new Vector3(Device.Direction.X * _Speed, _Rb.velocity.y); if (Device.Direction.X >= 0.01) { this.gameObject.transform.rotation = Quaternion.Euler(0f, 90f, 0f); } else if (Device.Direction.X <= -0.01) { this.gameObject.transform.rotation = Quaternion.Euler(0f, 270f, 0f); } if (Device.Action1.WasPressed && IsGrounded() && Grabbing == false) { _AudioSource.PlayOneShot(_Jump[Random.Range(0, _Jump.Length)], 0.4f); _AudioSource.PlayOneShot(_VoiceJump[Random.Range(0, _VoiceJump.Length)], 1f); _Anim.SetTrigger("Jump"); _Jumped = true; _Rb.velocity = Vector3.up * _JumpHeight; } else if (Device.Action1.WasPressed && IsGrounded() && Grabbing == true) { _AudioSource.PlayOneShot(_Jump[Random.Range(0, _Jump.Length)], 0.4f); _AudioSource.PlayOneShot(_VoiceJump[Random.Range(0, _VoiceJump.Length)], 1f); _Anim.SetTrigger("Grabbing_Jump"); _Jumped = true; _Rb.velocity = Vector3.up * _JumpHeight; } if (Grabbing == false) { if (_IsGrounded == true && Device.Direction.X >= 0.001) { _Anim.SetFloat("Moving", Device.Direction.X); } else { _Anim.SetFloat("Moving", Device.Direction.X); } } else if (Grabbing == true) { if (_IsGrounded == true && Device.Direction.X >= 0.001) { _Anim.SetFloat("Grab_Moving", Device.Direction.X); } else { _Anim.SetFloat("Grab_Moving", Device.Direction.X); } } } if (p2 == Player2State.Smoke) { Grabbing = false; var _BoxCollider = GetComponent <BoxCollider>(); var _SmokeGirl = GameObject.Find("m_char_smokegirl"); _BoxCollider.enabled = false; if (Device.Direction.X >= 0.01) { if (_SoundCheckWaterMoving == false) { _AudioSource.loop = true; _AudioSource.clip = _WaterMove; _AudioSource.Play(); _SoundCheckWaterMoving = true; } this.gameObject.transform.rotation = Quaternion.Euler(0f, 90f, 0f); _SecondStateObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f); } else if (Device.Direction.X <= -0.01) { if (_SoundCheckWaterMoving == false) { _AudioSource.loop = true; _AudioSource.clip = _WaterMove; _AudioSource.Play(); _SoundCheckWaterMoving = true; } _SecondStateObject.transform.rotation = Quaternion.Euler(0f, 90f, 0f); this.gameObject.transform.rotation = Quaternion.Euler(0f, -180f, 0f); } } } }