void GreenShell() { GameObject instantiatedObj = Instantiate(obj, ctrl.spawnFwd.position, transform.rotation) as GameObject; instantiatedObj.name = "GreenShell"; instantiatedObj.gameObject.AddComponent <GreenShell>(); instantiatedObj.tag = "missile"; instantiatedObj.AddComponent <BoxCollider>(); instantiatedObj.GetComponent <Renderer>().material.mainTexture = missile_texture; GreenShell shell = instantiatedObj.gameObject.GetComponent <GreenShell>(); shell.speed = transform.forward * 50f; Object.Destroy(instantiatedObj, 15f); }
static void Main(string[] args) { GreenShell green = new GreenShell(); RedShell red = new RedShell(); BlueShell blue = new BlueShell(); Console.Clear(); int input = Convert.ToInt32(Console.ReadLine()); if (input == 1) { green.abc(); } else if (input == 2) { red.abc(); } else if (input == 3) { blue.abc(); } }
static void Main(string[] args) { GreenShell GreenShell = new GreenShell(); GreenShell.spell(); }