the script gave me error cs1526
this is my script:
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
public float moveSpeed;
public float jumpHeight;
public Transform groundCkeck;
public float groundCheckRadius;
public LayerMask whatIsGround;
private bool grounded;
private bool doubleJump;
private Animator anim;
void Start ()
{
anim = GetComponent<Animator> ();
}
void FixedUpdate()
{
grounded = Physics2D.OverlapCircle (groundCkeck.position, groundCheckRadius, whatIsGround);
}
void Update ()
{
if (grounded)
doubleJump = false;
anim.SetBool ("Grounded", grounded);
if (Input.GetKeyDown (KeyCode.Space) && grounded)
{
GetComponent<Rigidbody2D>().velocity = new Vector2 (GetComponent<Rigidbody2D>().velocity.x, jumpHeight);
}
if (Input.GetKeyDown (KeyCode.Space) && !doubleJump && !grounded)
{
GetComponent<Rigidbody2D>().velocity = new Vector2 (GetComponent<Rigidbody2D>().velocity.x, jumpHeight);
doubleJump = true;
}
if (Input.GetKey (KeyCode.D))
{
GetComponent<Rigidbody2D>().velocity = new Vector2 (moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
}
if (Input.GetKey (KeyCode.A))
{
GetComponent<Rigidbody2D>().velocity = new Vector2 (-moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
}
anim.SetFloat("Speed", Mathf.Abs(GetComponent<Rigidbody2D>().velocity.x));
if (GetComponent<Rigidbody2D> ().velocity.x > 0)
transform.localScale = new Vector3(if, if, if);
else if(GetComponent<Rigidbody2D>().velocity.x < 0)
transform.localScale = new Vector3(-if, if, if);
}
}
Yes, DateTime. The first line of the description on that page states: "The Now property returns a DateTime value". And the first line of the example code shows a DateTime variable used to store that value: DateTime localDate = DateTime.Now;
– tanoshimi