Skip to content

Commit

Permalink
-Made a WIP model for a royal.
Browse files Browse the repository at this point in the history
-Testing block movement via mouse.
  • Loading branch information
mlee094 committed Mar 27, 2013
1 parent 4c83910 commit fa1c191
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions SiegeDefenseCode/Assets/BlockScript.cs
@@ -0,0 +1,65 @@
using UnityEngine;
using System.Collections;

public class BlockScript : MonoBehaviour {
Vector3 screenPoint;
Vector3 offset;

// Use this for initialization
void Start () {

}

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

Vector3 mousePointerWorldPos = Camera.main.ScreenToWorldPoint( Input.mousePosition);
//Debug.Log ("MOUSEPOINTERWORLD: " + mousePointerWorldPos);
}

void onMouseClick()
{

}

void BlockFunction()
{
if(Input.GetMouseButtonDown(0))
{
Debug.Log ("MOUSE BUTTON 0");
//Debug.Log ("DRAG!");
}
else if(Input.GetMouseButtonDown (1))
{
Debug.Log ("MOUSE BUTTON 1");
}
}

void OnMouseDown()
{
Debug.Log ("DOWN!");
screenPoint = Camera.main.WorldToScreenPoint (transform.position);
//Debug.Log ("ScreenPoint");
offset = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
/*while (Input.GetMouseButton(0))
{
Debug.Log ("DRAGGING!");
}*/
}
void OnMouseDrag()
{
Debug.Log ("DRAGGING.");



Vector3 currentScreenPos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);

Vector3 currentPos = Camera.main.ScreenToWorldPoint(currentScreenPos) + offset;

Debug.Log ("CURRENT POS: " + currentPos);
transform.position = currentPos;

//Debug.Log ("DRAGGING!");
}
}
Binary file not shown.
Binary file added SiegeDefenseCode/Assets/Royal.prefab
Binary file not shown.
Binary file modified SiegeDefenseCode/Assets/SiegeDefense.unity
Binary file not shown.

0 comments on commit fa1c191

Please sign in to comment.