Commit 9620f1c4 authored by Martin Finkel's avatar Martin Finkel
Browse files

remove unused materials

parent 14d342eb
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharacterControl : MonoBehaviour
{
private Vector3 moveDirection = Vector3.zero;
private Vector3 rotationDirection = Vector3.zero;
private float moveSpeed = 10f;
private float rotationSpeed = 30f;
public VJHandler jsMovement;
public VJHandler jsLook;
private Vector3 direction;
private Vector3 look;
private void Update ()
{
CharacterController controller = GetComponent<CharacterController> ();
/*
moveDirection = transform.TransformDirection (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
moveDirection *= moveSpeed;
controller.Move (moveDirection * Time.deltaTime);
rotationDirection = new Vector3 (Input.GetAxisRaw ("Vertical2"), Input.GetAxisRaw ("Horizontal2"), 0);
rotationDirection *= rotationSpeed * Time.deltaTime;
transform.Rotate (rotationDirection);
*/
look = jsLook.InputDirection;
if (look.magnitude != 0) {
rotationDirection = new Vector3 (-look.y, look.x, 0) * rotationSpeed * Time.deltaTime;
transform.eulerAngles = transform.eulerAngles + rotationDirection;
}
direction = jsMovement.InputDirection;
if (direction.magnitude != 0)
{
moveDirection = new Vector3 (direction.x, 0, direction.y) * moveSpeed;
moveDirection = Camera.main.transform.TransformDirection(moveDirection);
moveDirection.y = 0;
controller.Move (moveDirection * Time.deltaTime);
//transform.position += new Vector3 (direction.x, 0, direction.y) * moveSpeed * Time.deltaTime;
}
}
}
\ No newline at end of file
......@@ -108,10 +108,6 @@ private IEnumerator CallPluginAtEndOfFrames()
tex.UpdateExternalTexture(texptr);
}
}
// Issue a plugin rendering event with arbitrary integer identifier.
// TODO: Remove or implement
//GL.IssuePluginEvent (GetRenderEventFunc (), 1);
}
}
}
......
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class VJHandler : MonoBehaviour,IDragHandler, IPointerUpHandler, IPointerDownHandler {
private Image jsContainer;
private Image joystick;
public Vector3 InputDirection ;
void Start(){
jsContainer = GetComponent<Image>();
joystick = transform.GetChild(0).GetComponent<Image>(); //this command is used because there is only one child in hierarchy
InputDirection = Vector3.zero;
}
public void OnDrag(PointerEventData ped){
Vector2 position = Vector2.zero;
//To get InputDirection
RectTransformUtility.ScreenPointToLocalPointInRectangle
(jsContainer.rectTransform,
ped.position,
ped.pressEventCamera,
out position);
position.x = (position.x/jsContainer.rectTransform.sizeDelta.x);
position.y = (position.y/jsContainer.rectTransform.sizeDelta.y);
float x = (jsContainer.rectTransform.pivot.x == 1f) ? position.x *2 + 1 : position.x *2 - 1;
float y = (jsContainer.rectTransform.pivot.y == 1f) ? position.y *2 + 1 : position.y *2 - 1;
InputDirection = new Vector3 (x, y, 0);
InputDirection = (InputDirection.magnitude > 1) ? InputDirection.normalized : InputDirection;
//to define the area in which joystick can move around
joystick.rectTransform.anchoredPosition = new Vector3 (InputDirection.x * (jsContainer.rectTransform.sizeDelta.x/3)
,InputDirection.y * (jsContainer.rectTransform.sizeDelta.y)/3);
}
public void OnPointerDown(PointerEventData ped){
OnDrag(ped);
}
public void OnPointerUp(PointerEventData ped){
InputDirection = Vector3.zero;
joystick.rectTransform.anchoredPosition = Vector3.zero;
}
}
\ No newline at end of file
This diff is collapsed.
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