Skip to content

Instantly share code, notes, and snippets.

Sean Duffy Shogan

Block or report user

Report or block Shogan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Shogan / ExampleLaserHit.cs
Created Aug 18, 2015
An example method that gets subscribed to the OnLaserHitTriggered event. This is attached to an entity, and when the laser raycast hits the entity, damage is dealt to it.
View ExampleLaserHit.cs
private void OnLaserHitTriggered(RaycastHit2D hitInfo)
if (hitInfo.collider.gameObject == gameObject)
if (bloodParticleSystem != null)
HealthPoints --;
Shogan / ExampleLaserStuff.cs
Created Aug 18, 2015
Example of laser damage event with interval
View ExampleLaserStuff.cs
public delegate void LaserHitTriggerHandler(RaycastHit2D hitInfo);
/// <summary>
/// Event that fires whenever the laser collides with an object (requires ignoreCollisions to be false). Subscribe to this event to be notified when the laser is hitting an object. The RaycastHit2D info will be sent through the event.
/// </summary>
public event LaserHitTriggerHandler OnLaserHitTriggered;
/// <summary>
/// Fires the OnLaserHitTriggered event every triggerInterval seconds.
/// </summary>
Shogan / gist:6587adafbaa3bac05be9
Created May 25, 2015
View gist:6587adafbaa3bac05be9
// Setup our credentials which will use our Cognito identity pool to hand us short-term session credentials,
// giving us access to what we have provided access to with our IAM role policies, in this case, access to our
// DynamoDB table.
credentials = new CognitoAWSCredentials(cognitoIdentityPoolString, RegionEndpoint.USEast1);
credentials.GetIdentityIdAsync(delegate(AmazonCognitoIdentityResult<string> result)
if (result.Exception != null)
Debug.LogError("exception hit: " + result.Exception.Message);
View gist:7bb02ff347cdc94ea069
private void CreateCharacterInTable()
var newCharacter = new CharacterEntity
CharacterID = Guid.NewGuid().ToString(),
BodySpriteName = selectedBody,
FaceSpriteName = selectedFace,
ShirtSpriteName = selectedShirt,
HairSpriteName = selectedHair,
PantsSpriteName = selectedPants,
Shogan / gist:853ee54b3ec0a405ef0e
Last active Aug 29, 2015
View gist:853ee54b3ec0a405ef0e
private void FetchAllCharactersFromAWS()
resultText.text = "\n***LoadTable***";
Table.LoadTableAsync(_client, "CharacterCreator", (loadTableResult) =>
if (loadTableResult.Exception != null)
resultText.text += "\n failed to load characters table";
Shogan / gist:aae54252966804fba1a4
Created May 25, 2015
View gist:aae54252966804fba1a4
Shogan / gist:e22d2336248af28aa465
Last active Aug 29, 2015
View gist:e22d2336248af28aa465
private void LoadCharacter(CharacterEntity characterEntity)
// Update the selected body component values stored as field values
selectedBody = characterEntity.BodySpriteName;
selectedFace = characterEntity.FaceSpriteName;
selectedHair = characterEntity.HairSpriteName;
selectedShirt = characterEntity.ShirtSpriteName;
selectedPants = characterEntity.PantsSpriteName;
selectedShoes = characterEntity.ShoesSpriteName;
View gist:ff42193696541e8ec646
private DynamoDBContext Context
if (_context == null)
_context = new DynamoDBContext(_client);
return _context;
Shogan / gist:be44b29f7b8e18832bc8
Last active Aug 29, 2015
View gist:be44b29f7b8e18832bc8
public string cognitoIdentityPoolString;
private CognitoAWSCredentials credentials;
private IAmazonDynamoDB _client;
private DynamoDBContext _context;
private List<CharacterEntity> characterEntities = new List<CharacterEntity>();
private int currentCharacterIndex;
Shogan / gist:9f075f43ac789d8520c3
Last active Aug 29, 2015
View gist:9f075f43ac789d8520c3
using System.Collections.Generic;
using Amazon.DynamoDBv2.DataModel;
namespace Assets.CharacterCreatorAWSDynamoDB.Scripts
public class CharacterEntity
[DynamoDBHashKey] // Hash key.
public string CharacterID { get; set; }
You can’t perform that action at this time.