thieumao

Unity - Di chuyen huong ngau nhien

Sep 1st, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class EnemyBehaviour : MonoBehaviour {
  5.     public Rigidbody2D rd;
  6.     // Use this for initialization
  7.     void Start () {
  8.         rd = GetComponent<Rigidbody2D> ();
  9.         Vector3 targetDirection = Random.insideUnitSphere * 5;
  10.         targetDirection.z = 0;
  11.         rd.velocity = targetDirection;
  12.     }
  13.    
  14.     // Update is called once per frame
  15.     void Update () {
  16.    
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment