void OnTriggerStay2D(Collider2D other) { if (!hasAuthority) { return; } if (dead) { return; } if (other.tag == Tags.item) { if (MyInputs.GetButtonDown(playerControlNumber, Tags.fire) && equiped == null) { Holdable h = other.GetComponent <Holdable>(); if (!h.IsEquiped) { equiped = h; CmdEquip(other.gameObject); } } } else if (other.tag == Tags.upgrade) { if (MyInputs.GetButtonDown(playerControlNumber, Tags.fire)) { CmdPickupUpgrade(other.gameObject); } } }
void Update() { if (MyInputs.GetButtonDown(0, Tags.escape)) { Application.Quit(); } }
void Jumping() { if (MyInputs.GetButtonDown(playerControlNumber, Tags.jump) && jumpsLeft > 0) { if (jumping && !(Time.time - timeWhenLeftGround < maxTimeForFreeAirJump))//they have been in the air for a while { jumpsLeft--; } //jumpsLeft--; whenever you leave the ground a jump is removed automatically rigid.velocity = new Vector2(rigid.velocity.x, jumpSpeed); } }
void Update() { float y = MyInputs.GetAxisRaw(playerControllerNumber, Tags.vertical); if (!falling && y < -0.85 && previousYValue > -0.75) { StartCoroutine(FallThroughFloor()); } if (MyInputs.GetButtonDown(playerControllerNumber, Tags.jump)) { } previousYValue = y; }
void Attacking() { if (equiped != null) { if (MyInputs.GetButton(playerControlNumber, Tags.fire)) { CmdFire(); } if (MyInputs.GetButtonDown(playerControlNumber, Tags.Throw)) { CmdThrow(); equiped = null; } else if (MyInputs.GetButtonDown(playerControlNumber, Tags.drop)) { CmdDrop(); equiped = null; } } }