topical media & game development
lib-unity-tutorial-m2h-2-Assets-Standard-Assets-Gem-Rendering-Example-GemSpawner.cs / cs
using UnityEngine;
using System.Collections;
public class GemSpawner : MonoBehaviour {
public Transform gem1, gem2, gem3, gem4;
public float spread = 5;
void Update () {
if (Input.GetKey ("1"))
((Transform)Instantiate (gem1)).position = transform.position + Random.insideUnitSphere * spread;
if (Input.GetKey ("2"))
((Transform)Instantiate (gem2)).position = transform.position + Random.insideUnitSphere * spread;
if (Input.GetKey ("3"))
((Transform)Instantiate (gem3)).position = transform.position + Random.insideUnitSphere * spread;
if (Input.GetKey ("4"))
((Transform)Instantiate (gem4)).position = transform.position + Random.insideUnitSphere * spread;
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.