Ejemplo n.º 1
0
    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);
            }
        }
    }
Ejemplo n.º 2
0
 void Update()
 {
     if (MyInputs.GetButtonDown(0, Tags.escape))
     {
         Application.Quit();
     }
 }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
    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;
    }
Ejemplo n.º 5
0
 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;
         }
     }
 }