This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Moves a vertex at an angle for a specific distance, 0 degrees points up and 180 degrees points down | |
* @param {array} point Location on a cartesian graph formatted as [x, y] | |
* @param {number} angle Angle at which a point should move in radians | |
* @param {number} distance How far should the point move at the given angle in pixels? | |
* @returns {array} Newly moved point formatted as [x, y] | |
*/ | |
function movePointAtAngle (point, angle, distance) { | |
return [ | |
point[0] + (Math.sin(angle) * distance), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
def parent_object_to_bone_by_name(armature, obj): | |
# Remove the 'O' prefix from the object's name to find the corresponding bone | |
bone_name = obj.name[1:] if obj.name.startswith("O") else None | |
if bone_name and bone_name in armature.pose.bones: | |
target_bone = armature.pose.bones[bone_name] | |
# Store the original world matrix of the object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class Platform : MonoBehaviour { | |
SpriteRenderer playerGraphic; | |
Rigidbody2D playerBody; | |
BoxCollider2D playerBox; | |
CircleCollider2D playerCircle; | |
float padTop = -0.2f; // Padding applied to the top of feet platform checks (prevents player from barely standing on platform) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @NOTE Must be called from FixedUpdate() to work properly | |
void NormalizeSlope () { | |
// Attempt vertical normalization | |
if (grounded) { | |
RaycastHit2D hit = Physics2D.Raycast(transform.position, -Vector2.up, 1f, whatIsGround); | |
if (hit.collider != null && Mathf.Abs(hit.normal.x) > 0.1f) { | |
Rigidbody2D body = GetComponent<Rigidbody2D>(); | |
// Apply the opposite force against the slope force | |
// You will need to provide your own slopeFriction to stabalize movement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
// For usage apply the script directly to the element you wish to apply parallaxing | |
// Based on Brackeys 2D parallaxing script http://brackeys.com/ | |
public class Parallax : MonoBehaviour { | |
Transform cam; // Camera reference (of its transform) | |
Vector3 previousCamPos; | |
public float distanceX = 0f; // Distance of the item (z-index based) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
namespace Adnc.Combat { | |
[System.Serializable] | |
public class StatHealth { | |
[Tooltip("Set health manually")] | |
[SerializeField] int health; | |
int healthMax; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
mongodb: | |
image: mongo:3.6.1 | |
container_name: uv-mongodb | |
volumes: | |
- mongodb:/data/db | |
- mongodb_config:/data/configdb | |
ports: | |
- 27017:27017 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DRAWER_CONTAINER = 'offer-drawer' | |
# Remove the drawer if the CSS class changes | |
_isMobileClass = false | |
$(window).resize(-> | |
mobileOn = $HTML.hasClass('mobile') | |
# Change detected, clear the existing class | |
if mobileOn != _isMobileClass | |
_isMobileClass = mobileOn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
// @NOTE the attached sprite's position should be "top left" or the children will not align properly | |
// Strech out the image as you need in the sprite render, the following script will auto-correct it | |
[RequireComponent (typeof (SpriteRenderer))] | |
// Generates a nice set of repeated sprites inside a streched sprite renderer | |
// @NOTE Vertical only, you can easily expand this to horizontal with a little tweaking | |
public class RepeatSpriteBoundary : MonoBehaviour { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Adnc.Utility; | |
using UnityEngine; | |
using UnityEngine.Events; | |
namespace CleverCrow.DungeonsAndHumans.Explorations { | |
public class TriggerEvents : MonoBehaviour { | |
private TriggerEventsInternal _internal; | |
[SerializeField] | |
private string _tag; |
NewerOlder