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

Implemented caramel camel prefab (minus art).

parent 29927019
fileFormatVersion: 2
guid: 05bb911049f95de48b2f21a54a6e7c42
folderAsset: yes
timeCreated: 1490918663
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 55f27ad16d33452449ab46d6ae33b206
timeCreated: 1490918663
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
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: 256
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Android
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: WebGL
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 0782f02b063b40842aa8836e9899e8fb
timeCreated: 1490918392
guid: 8661a74f5601bcc439f32768313bba41
timeCreated: 1490918833
licenseType: Free
NativeFormatImporter:
userData:
......
fileFormatVersion: 2
guid: ad48879683789a64c9aceaaa802be678
timeCreated: 1490919064
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a5ffcce8d36c01c489820f8cbeff2fcb
timeCreated: 1490920508
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 82860284b5d7bd84abe77e4d55cffcac
timeCreated: 1490920508
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class enemyProjectile : MonoBehaviour {
float travelDistance; //how far it can go
Vector2 start; //the starting point of the projectile
public void OnTriggerEnter2D(Collider2D other)
{
Debug.Log("collided");
if (!other.gameObject.CompareTag("Enemy"))
{
if (other.gameObject.CompareTag("Player"))
{
//damage player
}
Destroy(this.gameObject);
}
}
void Start()
{
start = transform.position;
}
void Update()
{
if (new Vector2(transform.position.x - start.x,
transform.position.y - start.y).magnitude > travelDistance) //if the projectile has travelled less than the max distance
{
Destroy(this.gameObject);
}
}
public void ProjectileExpiration(Vector2 velocity, float travelDistance)
{
GetComponent<Rigidbody2D>().velocity = velocity;
this.travelDistance = travelDistance;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class enemyProjectile : MonoBehaviour {
float travelDistance; //how far it can go
Vector2 start; //the starting point of the projectile
public void OnTriggerEnter2D(Collider2D other)
{
Debug.Log("collided");
if (!other.gameObject.CompareTag("Enemy"))
{
if (other.gameObject.CompareTag("Player"))
{
GameManager.Fail();
}
Destroy(this.gameObject);
}
}
void Start()
{
start = transform.position;
}
void Update()
{
if (new Vector2(transform.position.x - start.x,
transform.position.y - start.y).magnitude > travelDistance) //if the projectile has travelled less than the max distance
{
Destroy(this.gameObject);
}
}
public void ProjectileExpiration(Vector2 velocity, float travelDistance)
{
GetComponent<Rigidbody2D>().velocity = velocity;
this.travelDistance = travelDistance;
}
}
......@@ -5,16 +5,18 @@ using UnityEngine;
public class enemyRanged : BaseEnemy
{
public Collider2D fieldOfView; //the 2D collider trigger on the enemy's child object checking if the player is in range to fire
[Tooltip("Checks if player is overlapping trigger")]
public Collider2D fieldOfView; //the 2D collider trigger on the enemy's child object checking if the player is in range to fire
public GameObject projectile; //the prefab of enemy projectiles
public float maxDistance; //the distance projectiles can travel;
public float projectileSpeed; //how fast the projectiles travel
public float fireCooldown; //the time between enemy attacks in units of seconds
float fireTimer;
public bool isFacingRight; //modifies the velocity of the fired projectile according to direction
float fireTimer;
[Tooltip("Flips the collider and projectile")]
public bool isFacingRight; //modifies the velocity of the fired projectile according to direction
public float angleOfSpread; //the greatest possible angle from the center projectiles can randomly spread; ******entered in radians*******
......@@ -54,8 +56,13 @@ public class enemyRanged : BaseEnemy
GameObject projectileInstance = Instantiate(projectile,gameObject.transform);
projectileInstance.transform.position = transform.position;
if (!isFacingRight)
// Flip projectile
Vector3 locScale = projectileInstance.transform.localScale;
locScale.x *= isFacingRight ? -1 : 1;
projectileInstance.transform.localScale = locScale;
if (!isFacingRight)
{
projectileInstance.GetComponent<enemyProjectile>().ProjectileExpiration(new Vector2(-projectileSpeed * directionModifier.x, projectileSpeed * directionModifier.y), maxDistance);
}
......
using UnityEngine;
using System.Collections;
public class BreakawayPlatform : MonoBehaviour {
public float timeTilBreak = 2f;
private Animator anim;
private bool isBroken = false;
public GameObject crumbParticles;
using UnityEngine;
using System.Collections;
public class BreakawayPlatform : MonoBehaviour {
public float timeTilBreak = 2f;
private Animator anim;
private bool isBroken = false;
public GameObject crumbParticles;
void Start() {
anim = GetComponent<Animator>();
}
private void Break(){
isBroken = true;
anim.SetBool("Broken", true);
Invoke("CreateCrumbs", timeTilBreak);
Destroy (gameObject, timeTilBreak);
}
}
private void Break(){
isBroken = true;
anim.SetBool("Broken", true);
Invoke("CreateCrumbs", timeTilBreak);
Destroy (gameObject, timeTilBreak);
}
private void CreateCrumbs() {
GameObject crumbClone = Instantiate(crumbParticles, transform.position, Quaternion.identity);
GameObject crumbClone = Instantiate(crumbParticles, transform.position, Quaternion.identity);
Destroy(crumbClone, 2);
}
private void OnCollisionEnter2D (Collision2D col) {
if (col.gameObject.CompareTag ("Player") && !isBroken) {
Break();
}
}
}
private void OnCollisionEnter2D (Collision2D col) {
if (col.gameObject.CompareTag ("Player") && !isBroken) {
Break();
}
}
}
\ No newline at end of file
m_EditorVersion: 5.5.1f1
m_EditorVersion: 5.5.0f3
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