using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
public class ballCtrl : MonoBehaviour
{
private bool isRightPressed = false;
private bool isLeftPressed = false;
public bool isCrashed = false;
private Rigidbody2D rb;
public float sensivity;
void Start () {
rb = GetComponent<Rigidbody2D> ();
}
void Update () {
if (!isRightPressed && !isLeftPressed) {
//Debug.Log ("What the...?");
return;
} else if (isLeftPressed) {
//Left
rb.AddForce (Vector2.left * Time.deltaTime * sensivity);
Debug.Log ("Left Go");
} else {
//Right
rb.AddForce (Vector2.right * Time.deltaTime * sensivity);
Debug.Log ("Right Go");
}
}
public void LeftDown(){
isLeftPressed = true;
Debug.Log ("Left Down");
}
public void LeftUp(){
isLeftPressed = false;
Debug.Log ("Left Up");
}
public void RightDown(){
isRightPressed = true;
Debug.Log ("Right Down");
}
public void RightUp(){
isRightPressed = false;
Debug.Log ("Right Up");
}
}
How to make this move?? Actor that this script connected aren’t moving.
public float sensivity;
is not 0, and also I checked that these functions are called.
(LeftDown, LeftUp, RightDown, RightUp)
PLZ HELP