void OnTriggerStay(Collider other) { bool crossPossible = other.tag == "Player" && ReadyToCross() && Input.GetButton("Jump"); if (!crossPossible) { return; } SpecimenFeaturesManager thisManager = GetComponent <SpecimenFeaturesManager> (); SpecimenFeaturesManager otherManager = other.GetComponent <SpecimenFeaturesManager> (); Tuple <SpecimenFeatures, SpecimenFeatures> result = genetics.Cross(thisManager.features, otherManager.features); thisManager.NewFeatures(result.First); otherManager.NewFeatures(result.Second); lastCross = Time.time; movement.PlayerLeft(); Debug.Log( "Cross finished:\n" + "in: " + thisManager.features.ToString() + "\n" + "in: " + otherManager.features.ToString() + "\n" + "out: " + result.First.ToString() + "\n" + "out: " + result.Second.ToString() + "\n" ); }
private void SetUpPlayer() { GameObject player = GameObject.FindGameObjectWithTag("Player"); SpecimenFeaturesManager featuresManager = player.GetComponent <SpecimenFeaturesManager> (); featuresManager.NewFeatures(genetics.playerAtStart); }
private void CreateRandomSpecimen() { Vector3 position = new Vector3(Random.Range(-maxX, maxX), 0.5f, Random.Range(-maxZ, maxZ)); Transform specimen = Instantiate(prefab, position, Quaternion.identity) as Transform; specimen.SetParent(specimens.transform); SpecimenFeaturesManager renderer = specimen.GetComponent <SpecimenFeaturesManager>(); renderer.NewFeatures(genetics.Randomized()); }