Commit 4933d824 authored by Luke Smith's avatar Luke Smith

Corners done

parent cb83e93d
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": /*"C:\\Windows\\System32\\net.exe", //*/"dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [ ],
"isBuildCommand": true,
"showOutput": "silent",
"problemMatcher": "$msCompile"
}
]
}
\ No newline at end of file
fileFormatVersion: 2
guid: 3764e353075fb0a4ab338a76cc986445
timeCreated: 1486267116
timeCreated: 1487788365
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
fileIDToRecycleName:
21300000: X_0
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
linearTexture: 0
correctGamma: 0
fadeOut: 0
......@@ -19,14 +20,14 @@ TextureImporter:
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
textureFormat: 4
maxTextureSize: 2048
textureSettings:
filterMode: -1
......@@ -38,18 +39,33 @@ TextureImporter:
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 1
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: 64
spriteBorder: {x: 4, y: 4, z: 4, w: 4}
spritePixelsToUnits: 56
alphaIsTransparency: 1
textureType: 8
textureType: 5
buildTargetSettings: []
spriteSheet:
sprites: []
sprites:
- name: X_0
rect:
serializedVersion: 2
x: 4
y: 4
width: 56
height: 56
alignment: 0
pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -28, y: 28}
- {x: -28, y: -28}
- {x: 28, y: -28}
- {x: 28, y: 28}
outline: []
spritePackingTag:
userData:
......
fileFormatVersion: 2
guid: 4a8ddad7f3c95d24281cf4e9c14da891
timeCreated: 1487885684
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: f5015e51666ab3b4e9a750c868d6703b
folderAsset: yes
timeCreated: 1487785551
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,7 +6,7 @@ public class ToggleEnemy : MonoBehaviour {
Camera cam;
public List<Collider2D> enemies;
List<BaseEnemy> disabledEnemies;
//List<BaseEnemy> disabledEnemies;
// Use this for initialization
void Start () {
......@@ -22,7 +22,7 @@ public class ToggleEnemy : MonoBehaviour {
//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;
//enemies[i].gameObject.GetComponent<BaseEnemy>().enabled = false;
enemies.Remove(enemies[i]);
}
}
......
fileFormatVersion: 2
guid: c7ca022d5dbae2f43a9a23d5ca5ee019
timeCreated: 1487785552
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using UnityEditor;
using System;
public class Borders : MonoBehaviour
{
public int top = 0, right = 0, bottom = 0, left = 0; // Border sizes by pixel
public bool setup = false;
private enum Direction{none, t, r, rt, b, bt, br, brt, l, lt, lr, lrt, lb, lbt, lbr, lbrt}
private enum Direction{none=0, t=1, r=2, rt, b=4, bt, br, brt, l=8, lt, lr, lrt, lb, lbt, lbr, lbrt}
// Binary representation:
// lbrt
// 0000
......@@ -29,7 +30,10 @@ public class Borders : MonoBehaviour
Color32[] pixels = tex.GetPixels32();
tex.SetPixels32(setBorders(pixels, tex.width, tex.height, checkAdjacency()));
Direction borders = checkAdjacency();
pixels = setBorderEdges(pixels, tex.width, tex.height, borders);
pixels = setBorderCorners(pixels, tex.width, tex.height, borders);
tex.SetPixels32(pixels);
tex.Apply(false);
sr.sprite = Sprite.Create(tex, sr.sprite.rect, new Vector2(.5f, .5f), sr.sprite.pixelsPerUnit);
......@@ -37,7 +41,7 @@ public class Borders : MonoBehaviour
}
}
Direction checkAdjacency()
Direction checkAdjacency()
{
Direction d = Direction.none;
Vector3 pos = transform.position;
......@@ -66,7 +70,7 @@ public class Borders : MonoBehaviour
return d;
}
Color32[] setBorders(Color32[] pixels, int width, int height, Direction d)
Color32[] setBorderEdges(Color32[] pixels, int width, int height, Direction d)
{
if((d & Direction.t) > 0) // top
{
......@@ -112,6 +116,53 @@ public class Borders : MonoBehaviour
return pixels;
}
private Color32[] setBorderCorners(Color32[] pixels, int width, int height, Direction d)
{
if((d & Direction.rt) > 0) // Top-right
{
for(int i = width - right*2; i < width - right; i++)
{
for(int j = height - top*2; j < height - top; j++)
{
pixels[j*width + i] = pixels[(j+top)*width + i+right];
}
}
}
if((d & Direction.br) > 0) // Bottom-right
{
for(int i = width - right*2; i < width - right; i++)
{
for(int j = bottom; j < bottom*2; j++)
{
pixels[j*width + i] = pixels[(j-bottom)*width + i+right];
}
}
}if((d & Direction.lb) > 0) // Bottom-left
{ // TODO: This
for(int i = left; i < left*2; i++)
{
for(int j = bottom; j < bottom*2; j++)
{
pixels[j*width + i] = pixels[(j-bottom)*width + i-left];
}
}
}
if((d & Direction.lt) > 0) // Top-left
{
for(int i = left; i < left*2; i++)
{
for(int j = height - top*2; j < height - top; j++)
{
pixels[j*width + i] = pixels[(j+top)*width + i-left];
}
}
}
return pixels;
}
public static void initializeAll()
{
Borders[] bs = GameObject.FindObjectsOfType<Borders>();
......
......@@ -10,7 +10,7 @@ public class WinTrigger : MonoBehaviour {
if(other.gameObject.name == "Player") //ensuring it's the player
{
//tell manager it has won
GameEditor.Win();
//GameEditor.Win();
//Debug.Log("Victory Achieved");
}
}
......
m_EditorVersion: 5.3.5f1
m_StandardAssetsVersion: 0
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