Commit 4ff06f7d authored by Andrew Van Buren's avatar Andrew Van Buren

Added water boss.

parent cc391d22
fileFormatVersion: 2
guid: f75bd14e60edeee4d94b75b5303e00cc
timeCreated: 1479435946
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: cb9ef59e102386f4c9779383e5b8b70d
timeCreated: 1479434042
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d4c1bacb400512d4e9b64f9075a358cc
timeCreated: 1479438886
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
public class Boss : MonoBehaviour {
private Rigidbody2D rb;
public float speed = 1f;
public GameObject[] waypoints;
private Transform currentWaypoint;
public float distanceThreshold = 0.5f;
public GameObject projectile;
public float attackCooldown = 2.0f;
public float attackRandom = 1.0f;
private float lastAttack = 0;
public float projectileSpeed = 5;
public int health = 100;
public GameObject diety;
// Use this for initialization
void Start () {
waypoints = GameObject.FindGameObjectsWithTag("Waypoint");
rb = GetComponent<Rigidbody2D>();
PickWaypoint();
}
// Update is called once per frame
void Update () {
if (currentWaypoint) {
if (Vector2.Distance(transform.position, currentWaypoint.position) < distanceThreshold) {
PickWaypoint();
} else {
Vector2 dir = currentWaypoint.position - transform.position;
Vector2 force = new Vector2(dir.x, dir.y) * speed;
rb.AddForce(Vector2.ClampMagnitude(force, speed));
}
}
if(Time.time > lastAttack) {
lastAttack = Time.time + attackCooldown + Random.Range(0, attackRandom);
Shoot(0);
Shoot(90);
Shoot(180);
Shoot(270);
}
}
void PickWaypoint() {
currentWaypoint = waypoints[Random.Range(0, waypoints.Length)].transform;
}
void Shoot(int angle) {
float rad = (angle + 90) * Mathf.Deg2Rad;
Vector2 vel = new Vector2(Mathf.Cos(rad), Mathf.Sin(rad)) * projectileSpeed;
GameObject projectile_clone = Instantiate(projectile, transform.position, Quaternion.identity) as GameObject;
projectile_clone.GetComponent<Rigidbody2D>().velocity = vel;
projectile_clone.transform.eulerAngles = new Vector3(0, 0, angle);
}
void GetHit(int amount) {
health -= health;
if (health <= 0) {
Die();
}
}
void Die() {
Instantiate(diety, transform.position, Quaternion.identity);
Destroy(gameObject);
}
}
fileFormatVersion: 2
guid: 1637c8df298d2ef448fab676ee167299
timeCreated: 1479433452
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
public class EnemyProjectile : MonoBehaviour {
// TEMPORARY
// Does not damage player
void OnCollisionEnter2D(Collision2D col) {
Destroy(gameObject);
}
}
fileFormatVersion: 2
guid: 70394bdca2dfef640ba97907cce063d9
timeCreated: 1479437610
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 911bcc06125282a4090e3ed5fb83ec48
folderAsset: yes
timeCreated: 1479438864
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 19763cee83156c44ab316588500ecea8
timeCreated: 1479438864
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: e05ab78bc4749c3448433e6c62c520bf
timeCreated: 1479438865
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 3c48449688144c04a8a7a9cc3e3a3105
timeCreated: 1479435838
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: 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: 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: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 16
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 754ecd339772ddd4ca77212aae07c545
timeCreated: 1479438847
licenseType: Free
TextureImporter:
fileIDToRecycleName:
21300000: water_deity_0
21300002: water_deity_1
21300004: water_deity_2
21300006: water_deity_3
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: 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: 0
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 16
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites:
- name: water_deity_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 32
height: 32
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -9, y: 16}
- {x: -16, y: 14}
- {x: -16, y: -16}
- {x: 12, y: -16}
- {x: 16, y: -11}
- {x: 16, y: 11}
- {x: 10, y: 16}
- name: water_deity_1
rect:
serializedVersion: 2
x: 32
y: 0
width: 32
height: 32
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -7, y: 16}
- {x: -16, y: 12}
- {x: -16, y: -10}
- {x: -11, y: -16}
- {x: 12, y: -16}
- {x: 16, y: -10}
- {x: 16, y: 12}
- {x: 11, y: 16}
- name: water_deity_2
rect:
serializedVersion: 2
x: 64
y: 0
width: 32
height: 32
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -6, y: 16}
- {x: -9, y: 15}
- {x: -16, y: 13}
- {x: -16, y: -16}
- {x: 16, y: -16}
- {x: 16, y: 13}
- {x: 10, y: 16}
- name: water_deity_3
rect:
serializedVersion: 2
x: 96
y: 0
width: 32
height: 32
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -16, y: 16}
- {x: -16, y: -16}
- {x: 15, y: -16}
- {x: 16, y: -13}
- {x: 16, y: 12}
- {x: 8, y: 16}
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