-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refractored, added colour in inspector, created demo scene
- Loading branch information
1 parent
1c2f079
commit 0a7b843
Showing
784 changed files
with
406 additions
and
243 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file renamed
BIN
+13.1 KB
Assets/UG/Scenes/Demo.unity → Assets/Warping Grid/Scenes/Demo.unity
Binary file not shown.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.