//camera void Start() { iTween.CameraFadeAdd(); ChainJam jam = (ChainJam)MonoBehaviour.FindObjectOfType(typeof(ChainJam)); jam.AddFunctionBeforeExit(() => Fadeout(), 3); }
public void PlayerPushedOut(SumoWrestler defendant, SumoWrestler aggressor) { defendant.Restart(); if (aggressor) { ChainJam.AddPoints(aggressor.ID, 1); points[(int)aggressor.ID] += 1; } }
public static PlayerIndex GetControllerFromPlayerId(ChainJam.PLAYER player) { switch (player) { case ChainJam.PLAYER.PLAYER1: return PlayerIndex.One; case ChainJam.PLAYER.PLAYER2: return PlayerIndex.Two; case ChainJam.PLAYER.PLAYER3: return PlayerIndex.Three; case ChainJam.PLAYER.PLAYER4: return PlayerIndex.Four; default: return PlayerIndex.One; } }
private void die() { if (lastHit != null) { ChainJam.AddPoints(lastHit.id, 1); } this.transform.position = Platform.Platforms[ Random.Range(0, Platform.Platforms.Count - 1) ].transform.position + Vector3.up; }
void Walk() { _walkStepParticles.enableEmission = true; walkDirection = Vector3.zero; if (ChainJam.GetButtonJustPressed(id, ChainJam.BUTTON.A)) { animator.SetBool("Charge", true); } if (!ChainJam.GetButtonPressed(id, ChainJam.BUTTON.A)) { animator.SetBool("Charge", false); } //lastStepTimer -= Time.deltaTime; //if (lastStepTimer <= 0) //{ // lastStepTimer = _stepTimeout; // StartCoroutine(VibrateStep(0.1f)); //} if (ChainJam.GetButtonPressed(id, ChainJam.BUTTON.LEFT)) { walkDirection.x = -1; } else if (ChainJam.GetButtonPressed(id, ChainJam.BUTTON.RIGHT)) { walkDirection.x = 1; } if (ChainJam.GetButtonPressed(id, ChainJam.BUTTON.DOWN)) { walkDirection.z = -1; } else if (ChainJam.GetButtonPressed(id, ChainJam.BUTTON.UP)) { walkDirection.z = 1; } rigidbody.AddForce(walkDirection.normalized * _walkSpeed); rigidbody.velocity = Vector3.ClampMagnitude(rigidbody.velocity, _maxWalkSpeed); transform.LookAt(transform.position + walkDirection); // switch back to standing if (walkDirection == Vector3.zero) { lastStepTimer = 0; currentWalkState = Stand; } }
void Stand() { _walkStepParticles.enableEmission = false; // play animation if (ChainJam.GetButtonJustPressed(id, ChainJam.BUTTON.DOWN) || ChainJam.GetButtonJustPressed(id, ChainJam.BUTTON.UP) || ChainJam.GetButtonJustPressed(id, ChainJam.BUTTON.LEFT) || ChainJam.GetButtonJustPressed(id, ChainJam.BUTTON.RIGHT)) { // switch to walking currentWalkState = Walk; lastStepTimer = _stepTimeout; } }
void Idle() { chargeTimer -= Time.deltaTime; if (chargeTimer <= 0 && ChainJam.GetButtonJustPressed(id, ChainJam.BUTTON.A)) { chargeForce = transform.forward * _chargeSpeed; rigidbody.AddForce(chargeForce, ForceMode.Impulse); chargeTimer = _chargeTimeout; _chargeStartParticles.Play(); animator.SetBool("Charge", true); StartCoroutine(Vibrate(0.3f, 1, 1)); } }
Color GetColor(ChainJam.PLAYER id) { switch(id) { case ChainJam.PLAYER.PLAYER1: return new Color(49.0f / 255, 50.0f / 255, 50.0f / 255); case ChainJam.PLAYER.PLAYER2: return new Color(39.0f / 255, 173.0f / 255, 227.0f / 255); case ChainJam.PLAYER.PLAYER3: return new Color(238.0f / 255, 54.0f / 255, 138.0f / 255); case ChainJam.PLAYER.PLAYER4: return new Color(176.0f / 255, 209.0f / 255, 54.0f / 255); } return Color.black; }
void Update() { // X axis if ( ChainJam.GetButtonPressed(GetComponent <Player>().id, ChainJam.BUTTON.LEFT)) { axisX -= sensitivityX * Time.deltaTime; } if (ChainJam.GetButtonPressed(GetComponent <Player>().id, ChainJam.BUTTON.RIGHT)) { axisX += sensitivityX * Time.deltaTime; } if ( !ChainJam.GetButtonPressed(GetComponent <Player>().id, ChainJam.BUTTON.LEFT) && !ChainJam.GetButtonPressed(GetComponent <Player>().id, ChainJam.BUTTON.RIGHT) ) { axisX -= axisX * inertiaX * Time.deltaTime; } if (axisX > 1f) { axisX = 1f; } if (axisX < -1f) { axisX = -1f; } // Y axis if ( ChainJam.GetButtonPressed(GetComponent <Player>().id, ChainJam.BUTTON.DOWN)) { axisY -= sensitivityY * Time.deltaTime; } if (ChainJam.GetButtonPressed(GetComponent <Player>().id, ChainJam.BUTTON.UP)) { axisY += sensitivityY * Time.deltaTime; } if ( !ChainJam.GetButtonPressed(GetComponent <Player>().id, ChainJam.BUTTON.UP) && !ChainJam.GetButtonPressed(GetComponent <Player>().id, ChainJam.BUTTON.DOWN) ) { axisY -= axisY * inertiaY * Time.deltaTime; } if (axisY > 1f) { axisY = 1f; } if (axisY < -1f) { axisY = -1f; } //and the actual rotation! float rotationX = transform.localEulerAngles.y + axisX; rotationY += axisY; rotationY = Mathf.Clamp(rotationY, minimumY, maximumY); transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0); //jump if (ChainJam.GetButtonPressed(GetComponent <Player>().id, ChainJam.BUTTON.A)) { GetComponent <PlayerJump>().JumpToRandomPlatform(); } //shoot if (ChainJam.GetButtonJustPressed(GetComponent <Player>().id, ChainJam.BUTTON.B)) { Shoot(); } }