Skip to content

Commit

Permalink
Merged branch master into master
Browse files Browse the repository at this point in the history
  • Loading branch information
AdronTech committed Jan 22, 2017
2 parents a796b9c + a8d721d commit 7e93d88
Show file tree
Hide file tree
Showing 20 changed files with 109 additions and 15 deletions.
Binary file added GGJ17/Assets/Material/New Material.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions GGJ17/Assets/Material/New Material.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
8 changes: 8 additions & 0 deletions GGJ17/Assets/Material/SpawnParticleTrailMaterial.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified GGJ17/Assets/Prefab/BuildingBlocks/Building_Barracks.prefab
Binary file not shown.
Binary file modified GGJ17/Assets/Prefab/BuildingBlocks/Building_EnemyLair.prefab
Binary file not shown.
Binary file modified GGJ17/Assets/Prefab/BuildingBlocks/Building_Extractor.prefab
Binary file not shown.
Binary file modified GGJ17/Assets/Prefab/BuildingBlocks/Building_Flag.prefab
Binary file not shown.
Binary file modified GGJ17/Assets/Prefab/BuildingBlocks/Building_Wall.prefab
Binary file not shown.
Binary file modified GGJ17/Assets/Prefab/Node.prefab
Binary file not shown.
Binary file modified GGJ17/Assets/Scene/BlockTest.unity
Binary file not shown.
Binary file added GGJ17/Assets/Scene/MainScene.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions GGJ17/Assets/Scene/MainScene.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added GGJ17/Assets/Scene/Saman.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions GGJ17/Assets/Scene/Saman.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 34 additions & 6 deletions GGJ17/Assets/Script/Blocks/Building/Building_EnemyLair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,43 @@

public class Building_EnemyLair : AbstractBuildingBlock {

// Use this for initialization
void Awake () {
#region Instantiate
public GameObject spawnPrefab;
#endregion
public float spawnFrequence = 20;

// Use this for initialization
void Awake () {
BuildingBlockInit bbi = new BuildingBlockInit();
bbi.up = true;
bbi.up = false;
bbi.down = true;
bbi.sides = true;
bbi.sides = false;
Init(bbi);
}

void Start()
{
StartCoroutine(SpawnDrops());
}

public new void ShowNodes(bool topN, bool botN) { }
public new void HideNodes() { }
IEnumerator SpawnDrops()
{
ParticleSystem spwner = GetComponent<ParticleSystem>();
while (true)
{
yield return new WaitForSeconds(spawnFrequence);
if(spwner)spwner.Emit(1);
}
}

void OnParticleCollision(GameObject go)
{
Debug.Log("Blubl");
if (go.tag.Equals("Ground"))
{
Debug.Log("Blubl" + go.transform.position);
GameObject obj = Instantiate(spawnPrefab);
obj.transform.position = go.transform.position + Vector3.up * 1.2f;
}
}
}
7 changes: 7 additions & 0 deletions GGJ17/Assets/Script/Blocks/Building/Building_Flag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,11 @@ void Awake () {
bbi.sides = false;
Init(bbi);
}


public new void DestroyBuilding()
{
// Todo GameOver
Destroy(gameObject);
}
}
37 changes: 28 additions & 9 deletions GGJ17/Assets/Script/IsoCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@
using System.Collections.Generic;
using UnityEngine;

public class IsoCamera : MonoBehaviour {

public class IsoCamera : MonoBehaviour
{

public float panSpeed = 10, rotateSpeed = 100, zoomSpeed = 5;
private const float camFocusHeight = 0;
private Vector3 focusPoint, mousePosition;
private new Camera camera;
public float zoomMin, zoomMax;

// Use this for initialization
void Awake () {
// Use this for initialization
void Awake()
{
camera = GetComponent<Camera>();
Vector3 globalCamForwardDir = transform.forward;
Vector3 downProjectedCamForward = Vector3.Project(transform.TransformVector(Vector3.forward), Vector3.down);
float m = (transform.position.y - camFocusHeight) / downProjectedCamForward.magnitude;
focusPoint = transform.position + globalCamForwardDir * m;
}

// Update is called once per frame
void Update () {

// Update is called once per frame
void Update()
{
#region pan
Vector3 localMove = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0);
Vector3 groundMove = Vector3.ProjectOnPlane(transform.TransformVector(localMove), Vector3.up);
Expand All @@ -29,8 +33,8 @@ void Update () {
focusPoint += translation;
#endregion
// poll the mouse
if (Input.GetMouseButton(1))
#region rotate
if (Input.GetMouseButton(1))
{
Vector2 rotation = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));
rotation *= rotateSpeed * Time.deltaTime;
Expand All @@ -42,7 +46,22 @@ void Update () {
}
#endregion
#region zoom
camera.orthographicSize += Input.mouseScrollDelta.y * zoomSpeed * Time.deltaTime;
// reset if out of bounds
if (camera.orthographicSize < zoomMin)
{
camera.orthographicSize = zoomMin;
}
else if (camera.orthographicSize > zoomMax)
{
camera.orthographicSize = zoomMax;
}
// only move if target position is within bounds
float targetZoom = camera.orthographicSize + Input.mouseScrollDelta.y * zoomSpeed * Time.deltaTime;
if ((targetZoom >= zoomMin) &&
(targetZoom <= zoomMax))
{
camera.orthographicSize = targetZoom;
}
#endregion
}

Expand Down

0 comments on commit 7e93d88

Please sign in to comment.