Commit 338c1638 authored by Luke A Smith's avatar Luke A Smith
Browse files

Merge branch 'enemyHorizontal' into 'master'


See merge request !13
parents 95005fdc 750b38dd
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ToggleEnemy : MonoBehaviour {
Camera cam;
public List<Collider2D> enemies;
List<BaseEnemy> disabledEnemies;
// Use this for initialization
void Start () {
cam = Camera.main;
// Update is called once per frame
void Update () {
//get frustum of camera
Plane[] camPlanes = GeometryUtility.CalculateFrustumPlanes(cam);
for (int i = 0; i < enemies.Count; i++)
//check if enemy is in view of camera and disable if not
if (!GeometryUtility.TestPlanesAABB(camPlanes, enemies[i].bounds))
enemies[i].gameObject.GetComponent<BaseEnemy>().enabled = false;
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