Ejemplo n.º 1
0
    public void deleteDrop()
    {
        PickupObject toDrop       = state.getCarryList()[0];
        float        dropDistance = toDrop.getColliderHeight();

        state.getCarryList().Remove(toDrop);
        Destroy(toDrop.gameObject);
        state.setPlayerCarrying();

        foreach (PickupObject obj in state.getCarryList())
        {
            Vector3 newPosition = obj.gameObject.transform.position;
            newPosition.y         -= dropDistance;
            obj.transform.position = newPosition;
        }
    }
Ejemplo n.º 2
0
 public void drop()
 {
     if (carriedPickups.Count > 0)
     {
         PickupObject toDrop       = carriedPickups[0];
         float        dropDistance = toDrop.getColliderHeight();
         carriedPickups[0].dropTopPickup();
         carriedPickups.Remove(toDrop);
         setPlayerCarrying();
         foreach (PickupObject obj in carriedPickups)
         {
             Vector3 newPosition = obj.gameObject.transform.position;
             newPosition.y         -= dropDistance;
             obj.transform.position = newPosition;
         }
     }
 }
Ejemplo n.º 3
0
    public void pickup(PickupObject newPickup)
    {
        if (playersState != PlayerState.CARRYING)
        {
            setPlayerCarrying();
        }
        newPickup.transform.rotation = Quaternion.identity;
        float yOffset = newPickup.getColliderHeight();

        foreach (PickupObject obj in carriedPickups)
        {
            Vector3 newPosition = obj.gameObject.transform.position;
            newPosition.y         += yOffset;
            obj.transform.position = newPosition;
        }
        newPickup.pickupObject(this, carryPosition.position);
        // newPickup.setCarrier(this);
        addPickup(newPickup);
        removeCurrentPotentialPickup(newPickup);
        // newPickup.nullifyGravity();
        // newPickup.transform.position = carryPosition.position;
        // newPickup.transform.parent = this.transform;
    }