I dont know a thing about C# so could someone translate this code into javascript for me? thanks in advance
using UnityEngine;
public class MobSpawner : MonoBehaviour
{
public GameObject enemy;
public float spawnTime = 3f;
public Transform[] spawnPoints;
void Start ()
{
InvokeRepeating ("Spawn", spawnTime, spawnTime);
}
void Spawn ()
{
int spawnPointIndex = Random.Range (0, spawnPoints.Length);
Instantiate (enemy, spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation);
}
}
Zodiarc
2
class MobSpawner extends MonoBehaviour
{
public var enemy: GameObject;
public var spawnTime:float = 3f;
public var spawnPoints: Transform;
public function Start ():void
{
InvokeRepeating ("Spawn", this.spawnTime, this.spawnTime);
}
public function Spawn ():void
{
var spawnPointIndex: int = Random.Range (0, this.spawnPoints.Length);
Instantiate (enemy, this.spawnPoints[spawnPointIndex].position, this.spawnPoints[spawnPointIndex].rotation);
}
}
should do.