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
View gist:ff42193696541e8ec646
private DynamoDBContext Context
{
get
{
if (_context == null)
_context = new DynamoDBContext(_client);
return _context;
}
}
View gist:d1d6d52a9b2a8f435b2f
using Amazon;
using Amazon.CognitoIdentity;
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.DataModel;
using Amazon.DynamoDBv2.DocumentModel;
using Amazon.DynamoDBv2.Model;
@Shogan
Shogan / gist:853ee54b3ec0a405ef0e
Last active Aug 29, 2015
FetchAllCharactersFromAWS
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";
}
else
@Shogan
Shogan / gist:6587adafbaa3bac05be9
Created May 25, 2015
CharacterCreator-startup-and-initialisation
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);
}
@Shogan
Shogan / gist:e22d2336248af28aa465
Last active Aug 29, 2015
CharacterOperations-for-UI
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:7bb02ff347cdc94ea069
private void CreateCharacterInTable()
{
var newCharacter = new CharacterEntity
{
CharacterID = Guid.NewGuid().ToString(),
BodySpriteName = selectedBody,
FaceSpriteName = selectedFace,
ShirtSpriteName = selectedShirt,
HairSpriteName = selectedHair,
PantsSpriteName = selectedPants,
@Shogan
Shogan / gist:be44b29f7b8e18832bc8
Last active Aug 29, 2015
character-creator-fields
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
Shogan / gist:9f075f43ac789d8520c3
Last active Aug 29, 2015
CharacterEntityClass
View gist:9f075f43ac789d8520c3
using System.Collections.Generic;
using Amazon.DynamoDBv2.DataModel;
namespace Assets.CharacterCreatorAWSDynamoDB.Scripts
{
[DynamoDBTable("CharacterCreator")]
public class CharacterEntity
{
[DynamoDBHashKey] // Hash key.
public string CharacterID { get; set; }
@Shogan
Shogan / gist:aae54252966804fba1a4
Created May 25, 2015
character-creator-button-operation-listeners
View gist:aae54252966804fba1a4
createOperation.onClick.AddListener(CreateCharacterInTable);
refreshOperation.onClick.AddListener(FetchAllCharactersFromAWS);
NextCharacterButton.onClick.AddListener(CycleNextCharacter);
PrevCharacterButton.onClick.AddListener(CyclePrevCharacter);
@Shogan
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)
{
bloodParticleSystem.Play();
HealthPoints --;
}
}
You can’t perform that action at this time.