Commit 50259636 authored by Andrew R Van Buren's avatar Andrew R Van Buren

Merge branch 'hazard' into 'master'

Hazard

See merge request !41
parents 9b5b0014 f4ef43de
fileFormatVersion: 2
guid: 22d3bdccbdefc68469c9bd4ac78e2aab
timeCreated: 1490919620
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
No preview for this file type
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DashEnemy : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
fileFormatVersion: 2
guid: ec9d944083c058349b98a056a253a787
timeCreated: 1488500641
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyCharge : BaseEnemy
{
public float DetectionDistance;
public float ChargeSpeed;
public bool Charging = false;
public LayerMask lm;
void FixedUpdate()
{
Vector2 fwd;
if (!sr.flipX) {
// Raycast to check if player is in front with layermask to prevent it from detecting itself
fwd = transform.TransformDirection (Vector2.right);
} else {
fwd = transform.TransformDirection (Vector2.left);
}
RaycastHit2D hit;
Debug.DrawRay (transform.position, fwd);
hit = Physics2D.Raycast (transform.position, fwd, DetectionDistance, lm);
if (hit)
{
if (hit.collider.gameObject.CompareTag ("Player"))
{//If it sees an object with tag "Player", Charging will be true
Charging = true;
}
}
if (Charging)
{ //Will move forward quickly when Charging is True
if (!CheckCollision (fwd, sr.flipX ? leftCollisionPos.position : rightCollisionPos.position))
{
Charging = false;
return;
}
Move (fwd);
speed = ChargeSpeed;
}
}
}
fileFormatVersion: 2
guid: 43e4e60b0ca845f46b29944b857dc156
timeCreated: 1487898296
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
No preview for this file type
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