Commit 4b6dec6e authored by kgingras's avatar kgingras
Browse files

all 3 special weapon projectiles finished

parent 2f4de00c
using UnityEngine;
using System.Collections.Generic;
public class ExplosionBall : MonoBehaviour {
int launcher = 0;
bool activated = false;
bool destroyed = false;
bool destroyedInside = false;
public float growSpeed = 1.03f;
public float shrinkSpeed = .95f;
public float growTime = 2f;
public GameObject camSpace;
float timer = 0f;
GameManager GMscript;
public List<GameObject> triggerList = new List<GameObject>();
// Use this for initialization
void Start () {
GMscript = GameObject.Find("GameManager").GetComponent<GameManager>();
camSpace = GameObject.Find ("CameraSpace");
}
// Update is called once per frame
void Update () {
if(!activated && Input.GetButton("rightBumper" + launcher)){
activated = true;
Activate();
}
if(activated && !destroyed){
timer += Time.deltaTime;
if(timer > growTime){
destroyed = true;
Invoke("DestroyInside", 1f);
}
transform.localScale = new Vector3(transform.localScale.x * growSpeed, transform.localScale.y* growSpeed, transform.localScale.z * growSpeed);
}
if(destroyedInside){
transform.localScale = new Vector3(transform.localScale.x * shrinkSpeed, transform.localScale.y* shrinkSpeed, transform.localScale.z * shrinkSpeed);
if(transform.localScale.x < .1f){
Destroy(gameObject);
}
}
}
void OnTriggerEnter(Collider coll){
if(!activated){
activated = true;
Activate();
}
if(!triggerList.Contains(coll.gameObject)){
if(coll.gameObject.layer == LayerMask.NameToLayer("Local") || coll.gameObject.layer == LayerMask.NameToLayer("Remote") || coll.gameObject.layer == LayerMask.NameToLayer("Ball")){
triggerList.Add(coll.gameObject);
}
}
}
void OnTriggerExit(Collider coll){
if(triggerList.Contains(coll.gameObject)){
triggerList.Remove(coll.gameObject);
}
}
void Activate(){
gameObject.GetComponent<Rigidbody>().velocity = Vector3.zero;
}
void DestroyInside(){
destroyedInside = true;
foreach(GameObject obj in triggerList){
if(obj.tag == "Team1" || obj.tag == "Team2"){
obj.GetComponent<LocalHP>().killPlayer();
obj.transform.position = camSpace.transform.position;
obj.transform.rotation = Quaternion.FromToRotation(Vector3.forward,camSpace.transform.forward);
obj.GetComponent<Rigidbody>().velocity = Vector3.zero;
obj.GetComponent<Rigidbody>().AddForce(camSpace.transform.forward*60);
}
else if(obj.tag == "Ball"){
GMscript.SpawnBall();
Destroy(obj);
}
}
}
public void setLauncher(int player){
launcher = player;
}
}
fileFormatVersion: 2
guid: 3e121d5d278598640923ef1a179c0dd8
timeCreated: 1455764098
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 24d8e3ecb6c8fde46999ff6d80dbbe6a
timeCreated: 1455770853
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 2048
textureSettings:
filterMode: 0
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: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: f782c30102286084f83cf73e9b3d4ab8
timeCreated: 1455770862
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 2048
textureSettings:
filterMode: 0
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: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 4701a2623ba890b48b092c2b2a805ca1
timeCreated: 1455770870
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 2048
textureSettings:
filterMode: 0
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: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
......@@ -3,12 +3,15 @@ using System.Collections;
public class PowerUP : MonoBehaviour {
public float recharge = 10f;
public GameObject wallPrefab;
public GameObject blackholePrefab;
public GameObject explosionPrefab;
public int _powerup;
public bool empty = true;
public GameObject _PUobject;
......@@ -51,6 +54,11 @@ public class PowerUP : MonoBehaviour {
}
}
empty = false;
}
public void PickUp(){
Destroy(_PUobject);
Invoke ("SpawnPU", recharge);
}
}
fileFormatVersion: 2
guid: 792dc2144e4f9cc47845a3fdffc142eb
timeCreated: 1455764536
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 4e03fe636feac1045ba8d0056dbe0d62
timeCreated: 1455761112
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -22,6 +22,9 @@ public class PullObjects : MonoBehaviour {
void Update () {
timer += Time.deltaTime;
if(timer > timeAlive){
Destroy(gameObject);
}
team1Things = GameObject.FindGameObjectsWithTag("Team1");
team2Things = GameObject.FindGameObjectsWithTag("Team2");
ball = GameObject.FindGameObjectWithTag("Ball");
......@@ -58,7 +61,7 @@ public class PullObjects : MonoBehaviour {
if(coll.gameObject.GetComponent<LocalHP>() != null){
coll.gameObject.GetComponent<LocalHP>().killPlayer();
coll.gameObject.transform.position = camSpace.transform.position;
coll.gameObject.transform.rotation = Quaternion.Euler(camSpace.transform.forward);
coll.gameObject.transform.rotation = Quaternion.FromToRotation(Vector3.forward,camSpace.transform.forward);
coll.gameObject.GetComponent<Rigidbody>().velocity = Vector3.zero;
coll.gameObject.GetComponent<Rigidbody>().AddForce(camSpace.transform.forward*60);
}
......
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