Commit a8059fbf authored by Andrew Van Buren's avatar Andrew Van Buren

Merge branch 'character' of git.gmu.edu:gadig/four into character

parents ddcf4c90 2ee663c1
fileFormatVersion: 2
guid: f3704368ef4144da495124908430ad4c
timeCreated: 1475816775
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9e21addf110434c01b2af828e85594af
timeCreated: 1477612028
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 0f781884301604d078e1df5cef97ce7c
timeCreated: 1475816735
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 750bbb01cc4944df48acbe7bc6905465
timeCreated: 1475816749
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: afa3b25f0de7541cb9c01e694f6778e1
timeCreated: 1477008989
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7ba8836ef99f24bf39398dfb9009e9d8
timeCreated: 1475816760
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Actions : MonoBehaviour {
// The array full of the character's abilities
public GameObject[] abilities = new GameObject[4];
// *** Choose Ability ***
// Which ability is currently active
public GameObject currentAbility = null;
// A counter which lets you cycle through the abilities
public int abilitiesCounter = 0;
// Picture which shows which ability it active
public Image abilitiesImage;
// *** RotateAbilities ***
// The axis around which the abilities rotate
private Vector3 zAxis = new Vector3(0, 0, 1);
// The point around which the abilities rotate
public GameObject center;
public GameObject waterShieldPrefab;
public bool waterShieldUsable = true;
private float waterShieldTimer = 0.0f;
public float waterShieldCooldown = 5.0f;
private Color abilityUnusable;
private Color abilityUsable;
void Start () {
// Set the initial ability to something so that it's not null
CycleAbility();
abilityUnusable = new Color(255.0f,255.0f,255.0f,0.5f);
abilityUsable = new Color(255.0f,255.0f,255.0f,1.0f);
}
void Update () {
if(Input.GetButtonDown("Fire1")) {
UseAbility(currentAbility.name);
}
if(waterShieldUsable == false) {
waterShieldTimer += Time.deltaTime;
if(waterShieldTimer > waterShieldCooldown) {
waterShieldUsable = true;
waterShieldTimer = 0.0f;
}
abilitiesImage.GetComponent<Image>().color = abilityUnusable;
} else {
abilitiesImage.GetComponent<Image>().color = abilityUsable;
}
// If the player presses the button to choose an ability...
if(Input.GetButtonDown("Fire2")) {
// Increment the counter
abilitiesCounter++;
// Call the ChooseAbility() function
CycleAbility();
// A loop which will rotate each of the abilities in the array
foreach(GameObject ability in abilities) {
StartCoroutine(RotateAbility(ability));
}
}
}
void CycleAbility() {
// If the counter goes out of range of the array's size, reset it to 0
if(abilitiesCounter > abilities.Length - 1) {
abilitiesCounter = 0;
}
// Set the currentAbility to the one chosen by the abilitiesCounter
currentAbility = abilities[abilitiesCounter];
// Set the image of the gameObject of the ability equal to the picture of the currentAbility
abilitiesImage.GetComponent<Image>().sprite = currentAbility.GetComponent<SpriteRenderer>().sprite;
}
IEnumerator RotateAbility(GameObject ability) {
// Initially set the rotationCounter to 0
float rotationCounter = 0;
// This loop will rotate each element around a center pivot point
while(rotationCounter <= 8) {
ability.transform.RotateAround(center.transform.position, zAxis, 10f);
rotationCounter++;
yield return new WaitForSeconds(0.000000001f);
}
}
public void UseAbility(string myCurrentAbility) {
Debug.Log(myCurrentAbility);
switch(myCurrentAbility) {
case "Fireball":
Debug.Log("Casting fireball!");
break;
case "Water Shield":
if(waterShieldUsable == true) {
GameObject myShield = (GameObject)Instantiate(waterShieldPrefab, transform.position, Quaternion.identity);
WaterShield waterShield = myShield.GetComponent<WaterShield>();
waterShield.mainCharacter = this.gameObject.transform;
waterShieldUsable = false;
}
break;
case "Rock":
Debug.Log("Throwing a rock!");
break;
case "Breath of Air":
Debug.Log("Casting breath of air!");
break;
}
}
}
fileFormatVersion: 2
guid: 2da14653c84e44ccbaeb9e90ae797be1
timeCreated: 1475808355
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
public class WaterShield : MonoBehaviour {
public Transform mainCharacter;
public float durationTimer = 0.0f;
public float durationLength = 2.0f;
void Update () {
this.transform.position = mainCharacter.position;
durationTimer += Time.deltaTime;
if(durationTimer >= durationLength) {
Destroy(this.gameObject);
}
}
}
fileFormatVersion: 2
guid: 1978d911fc9b14ab4939f59a8c10d901
timeCreated: 1477009011
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 8b53374e83d3a49fdbceef35191ed16e
timeCreated: 1475814864
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 200
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 97b4b5e4f4cdc4c3db9cffbd3433bea9
timeCreated: 1475814864
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 200
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 5f156b1ab9b124139ac8f2b953314c32
timeCreated: 1475814864
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 200
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ea17000c4566e405e8d574a06daecdfd
timeCreated: 1475815355
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 200
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment