Need help with scirpting

Hi all,

Excuse me I am a newbie.

My personal project is this: a digital range simulator. I have a “two tone” airsoft gun which is gas operated which has realistic operating mechanisms, I am getting the modules from a light gun installed on the airsoft gun by my dad whos an electronic/mechanical engineer. So it works like a light gun using mouse left click for shooting using raycast hit i’ve coded that part.

My question is how do I code the following: I am using a 3D environment without using a “moving camera”. I have 8 game objects in their positions, after 3 seconds 2 random textures will be applied (textures A and B) to all game-objects so one game object could be a texture A or B. If texture A is shot +1 point and destroyed if all of the gameobjects with texture A is shot reload scene. Going to another scene I can code this part (go to another scene).

If texture B is shot go to next scene (I know how to code to go to next scene).

Things I’ve coded:
Timer start and stop
Raycast hit etc
gameobjects in place
calibration for light gun

May this gets you going:

using UnityEngine;
using System.Collections;

public class Spawner : MonoBehaviour {
	[SerializeField] GameObject PrefabA;
	[SerializeField] GameObject PrefabB;
	[SerializeField] Transform[] spawnPoints = new Transform[8];
	void Start(){
		for (int i = 0; i < spawnPoints.Length; i++){
			Instantiate((Random.Range(0,2) == 0 ? PrefabA : PrefabB), spawnPoints*.position, Quaternion.identity);*
  •  }*
  • }*