public InsectRobot(InsectRobot ir) { Debug.Log("insect robot"); bug = (GameObject)Instantiate(Resources.Load("Player")); colisionDetector = bug.GetComponent <ColisionDetector> (); resetPosition(); bug.layer = 8; fitness = ir.fitness; left1 = ir.left1; left2 = ir.left2; left3 = ir.left3; left4 = ir.left4; left5 = ir.left5; left6 = ir.left6; right1 = ir.right1; right2 = ir.right2; right3 = ir.right3; right4 = ir.right4; right5 = ir.right5; right6 = ir.right6; forward1 = ir.forward1; forward2 = ir.forward2; forward3 = ir.forward3; forward4 = ir.forward4; forward5 = ir.forward5; forward6 = ir.forward6; leftThreshold = ir.leftThreshold; rightThreshold = ir.rightThreshold; forwardThreshold = ir.forwardThreshold; }
public static void addRobot() { InsectRobot ir = new InsectRobot(); robotList.Add(ir); totalBugs = robotList.Count; Debug.Log(totalBugs); }
public static void cloneAll() { int numRobots = robotList.Count; for (int i = 0; i < numRobots; i++) { InsectRobot ir = new InsectRobot(robotList[i]); robotList.Add(ir); totalBugs = robotList.Count; Debug.Log("2355255378325377432073204532430"); } }
public static void outWithTheoldInWithTheNew() { for (int i = 0; i < robotList.Count; i++) { robotList [i].colisionDetector.isDead = false; if (i + (robotList.Count / 2) < robotList.Count) { //replace the shit with a deep copy of the good robotList[i].destroy(); robotList [i] = new InsectRobot(robotList [i + (robotList.Count / 2)]); } robotList [i].augment(); } }