Hi…
This script doesn’t work:
using UnityEngine;
using System.Collections;
public class Samolot : MonoBehaviour {
public float speed;
public float min;
public float max;
public float off;
void Start () {
speed = 0;
min = 0;
max = 1000;
off = 70;
}
void Update () {
if (Input.GetKey(KeyCode.W)) speed = speed +1;
if (Input.GetKey(KeyCode.S)) speed = speed -1;
if (speed <= min) speed = min;
if (speed >= max) speed = max;
#region rotation off
if (speed <= off) {
if (Input.GetAxis("Horizontal")) ;
if (Input.GetAxis("Vertical")) ;
}
#endregion
#region rotation on
if (speed <= off) {
if (Input.GetAxis("Horizontal") < 0)
transform.Rotate (0,0,60 * Time.deltaTime);
if (Input.GetAxis("Horizontal") > 0)
transform.Rotate (0,0,-60 * Time.deltaTime);
if (Input.GetAxis("Vertical") < 0)
transform.Rotate (60 * Time.deltaTime,0,0);
if (Input.GetAxis("Vertical") > 0)
transform.Rotate (-60 * Time.deltaTime,0,0);
}
#endregion
}
}
Assets/Samolot.cs(25,25): error CS0029: Cannot implicitly convert type float' to
bool’
Assets/Samolot.cs(26,25): error CS0029: Cannot implicitly convert type float' to
bool’