Skip to content

Instantly share code, notes, and snippets.

View DaveVoyles's full-sized avatar

Dave Voyles DaveVoyles

View GitHub Profile
//<summary>
//Check for user input and switch weapons accordingly
//</summary>
private void CheckIfSwitchingWeapon()
{
if (Input.GetButtonDown("SwitchWeapon"))
{
NextWeapon();
}
}
// This code came from: http://hobbyistcoder.com/product/2d-shooter-bullet-weapon-system-asset-unity3d/
private void BulletPresetChangedHandler()
{
switch (BulletPreset)
{
case BulletPresetType.Simple:
bulletCount = 1;
weaponFireRate = 0.15f;
bulletSpacing = 1f;
bulletSpread = 0.05f;
/// <summary>
/// Check for pickup type and set powerup effect on the player
/// Play a particle effect when touching a player, and despawn afterwards
/// </summary>
/// <param name="other">What are we colliding with? Should only check for player</param>
private void OnTriggerEnter(Collider other)
{
if (!other.gameObject.CompareTag("Player")) return;
SpawnTextWhenTouched();
@DaveVoyles
DaveVoyles / NextWeapon
Created December 16, 2014 14:30
Switching to the next weapon in a weapon inventory
/// <summary>
/// Switch to the next weapon in our inventory
/// </summary>
private void NextWeapon()
{
// Store the value of the next weapon
currentWeaponIndex ++;
// Reached the end of the array, start from the beginning
if (currentWeaponIndex >= weaponInventory.Length)
@DaveVoyles
DaveVoyles / Kinect Prepose
Created January 29, 2015 17:39
Kinect Prepose
// Declare a Prepose program named “soccer”
APP soccer:
 
       // We are building the “ola” or “wave” gesture
       // An app can have multiple gestures
@DaveVoyles
DaveVoyles / WinJS ANgular
Created February 17, 2015 23:04
HTML sample for WinJS in the browser
<button id="btn_submit" data-win-control="WinJS.UI.Tooltip" data-win-options="{innerHTML: 'Submit your Order'}">
{{HomePage.GitHubID}}
</button>
@DaveVoyles
DaveVoyles / AngularWinJSController
Created February 17, 2015 23:07
Illustrates how to execute WinJS code from within an Angular controler
"use strict";
(function () {
console.log("HomePageController loaded");
angular.module('app')
.controller('HomePageController', thingsandstuff);
function thingsandstuff() {
var vm = this;
vm.Title = "FSharp Web Kit";
vm.GitHubID = "GitHubID"; //TODO: set this w/ a Get call to retrieve GitHub ID from user
@DaveVoyles
DaveVoyles / designer.html
Last active August 29, 2015 14:16
designer
<link rel="import" href="../paper-radio-group/paper-radio-group.html">
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
<polymer-element name="x-radial-buttons">
<template>
<style>
#paper_radio_group {
left: 690px;
top: 380px;
@DaveVoyles
DaveVoyles / gist:6ab1a8aae38b7c9b0879
Created March 10, 2015 01:28
x-radial-buttons Polymer
<link href="bower_components/polymer/polymer.html" rel="import">
<link rel="import" href="../paper-radio-group/paper-radio-group.html">
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
<polymer-element name="x-radial-buttons">
<!-- Shadow DOM -->
<template>
<style>
#paper_radio_group {
(function (pokemonApp) {
// Grab inputs and button for speech-to-text
var form = document.querySelector('#player-form'),
input = document.querySelector('#player-input'),
playerElement = document.querySelector('#player-element'),
xPokemon = document.querySelector('#x-pokemon'),
btnChangeAccent = document.querySelector('#btn-change-accent'),
radialButtonTemplate = document.querySelector("#radial-button-template"),
playerAccent = playerElement.getAttribute("accent");