Skip to content

Commit

Permalink
refractored, added colour in inspector, created demo scene
Browse files Browse the repository at this point in the history
  • Loading branch information
GandhiGames committed Nov 22, 2016
1 parent 1c2f079 commit 0a7b843
Show file tree
Hide file tree
Showing 784 changed files with 406 additions and 243 deletions.
21 changes: 0 additions & 21 deletions Assets/UG/Scripts/Demo_Grid.cs

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
55 changes: 55 additions & 0 deletions Assets/Warping Grid/Scripts/Demo_Grid.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using UnityEngine;
using System.Collections;

public class Demo_Grid : MonoBehaviour {

public Grid grid;

[Header("Explosive")]
public float explosiveForce = 2f;
public float explosiveRadius = 2f;

[Header("Implosive")]
public float implosiveForce = 2f;
public float implosiveRadius = 2f;

[Header("Directional")]
public float directionalForce = 2f;
public float directionalRadius = 2f;

void Update () {

if(Input.GetMouseButtonUp(0))
{
grid.ApplyExplosiveForce(explosiveForce, Camera.main.ScreenToWorldPoint(Input.mousePosition), explosiveRadius);
}
else if(Input.GetMouseButtonUp(1))
{
grid.ApplyImplosiveForce(implosiveForce, Camera.main.ScreenToWorldPoint(Input.mousePosition), implosiveRadius);
}

var direction = Vector2.zero;

if(Input.GetKeyUp(KeyCode.LeftArrow))
{
direction = Vector2.left;
}
else if (Input.GetKeyUp(KeyCode.DownArrow))
{
direction = Vector2.down;
}
else if (Input.GetKeyUp(KeyCode.RightArrow))
{
direction = Vector2.right;
}
else if (Input.GetKeyUp(KeyCode.UpArrow))
{
direction = Vector2.up;
}

if (direction != Vector2.zero)
{
grid.ApplyDirectedForce(direction * directionalForce, Vector3.zero, directionalRadius);
}
}
}
File renamed without changes.
Loading

0 comments on commit 0a7b843

Please sign in to comment.