Vous êtes sur la page 1sur 1

using UnityEngine;

using System.Collections;

public class PlayerController : MonoBehaviour {

public float speed;

private Rigidbody rb;

void Start ()
{
rb = GetComponent<Rigidbody>();
}

void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");

Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);

rb.AddForce (movement * speed);


}

void OnTriggerEnter(Collider other) //Rajout d'une condition si la balle


entre en contact avec un autre objet.
{
if (other.gameObject.CompareTag ("Pick Up")) //Si l'objet comporte le tag
"Pick Up", l'objet devient inactif.
{
other.gameObject.SetActive (false);
}
}
}

// Ne pas oublier de réglé la vitesse dans la case speed du script apparut.

Vous aimerez peut-être aussi