void GruntSounds() { int rand = Random.Range(0, 5); if (rand == 0) { aS.clip = SoundManager.Instance.GetSound("Grunt1"); } if (rand == 1) { aS.clip = SoundManager.Instance.GetSound("Grunt2"); } if (rand == 2) { aS.clip = SoundManager.Instance.GetSound("Grunt3"); } if (rand == 3) { aS.clip = SoundManager.Instance.GetSound("Rage1"); } if (rand == 4) { aS.clip = SoundManager.Instance.GetSound("Rage2"); } if (rand == 5) { aS.clip = SoundManager.Instance.GetSound("Rage3"); } List <float> generatedNum = FeatureGenerator.GenerateNumbersFromString("asdasda"); aS.pitch = FeatureGenerator.remap(generatedNum[8], 0.0f, 1.0f, 0.2f, 0.9f); aS.volume = 0.9f; aS.Play(); }
void Awake() { //kirzde string aux = PlayerPrefs.GetString("PlayerName"); aux = aux == null || aux.Length < 5 ? getRandomString(6) : aux; generatedNum = FeatureGenerator.GenerateNumbersFromString(aux); probability = (int)FeatureGenerator.remap(generatedNum[9], 0.0f, 1.0f, 0.0f, 100.0f); mutateBody(); mutateWeapons(); }
private void mutateBody() { float thickness = FeatureGenerator.remap(generatedNum[6], 0.0f, 1.0f, -0.1f, 0.7f); float mass = FeatureGenerator.remap(generatedNum[6], 0f, 1f, 0.15f, 0.01f); GetComponent <PlayerController>().delayValues[1] = mass; GetComponent <PlayerController>().delayValues[3] = mass; //ARMS arm1.localScale = new Vector3(arm1.localScale.x + thickness, arm1.localScale.y + FeatureGenerator.remap(generatedNum[5], 0.0f, 1.0f, -0.3f, 0.7f), arm1.localScale.z); arm1.GetComponent <HingeJoint>().anchor = Vector3.up; hand1.localScale = new Vector3(hand1.localScale.x + thickness, hand1.localScale.y, hand1.localScale.z); hand1.GetComponent <HingeJoint>().anchor = Vector3.up; arm2.localScale = new Vector3(arm2.localScale.x + thickness, arm2.localScale.y + FeatureGenerator.remap(generatedNum[4], 0.0f, 1.0f, -0.3f, 0.7f), arm2.localScale.z); arm2.GetComponent <HingeJoint>().anchor = Vector3.up; hand2.localScale = new Vector3(hand2.localScale.x + thickness, hand2.localScale.y, hand2.localScale.z); hand2.GetComponent <HingeJoint>().anchor = Vector3.up; //LEGS leg1.localScale = new Vector3(leg1.localScale.x + thickness, leg1.localScale.y + FeatureGenerator.remap(generatedNum[4], 0.0f, 1.0f, -0.3f, 0.7f), leg1.localScale.z); leg1.GetComponent <HingeJoint>().anchor = Vector3.up; foot1.localScale = new Vector3(foot1.localScale.x + thickness, foot1.localScale.y, foot1.localScale.z); foot1.GetComponent <HingeJoint>().anchor = Vector3.up; leg2.localScale = new Vector3(leg2.localScale.x + thickness, leg2.localScale.y + FeatureGenerator.remap(generatedNum[5], 0.0f, 1.0f, -0.3f, 0.7f), leg2.localScale.z); leg2.GetComponent <HingeJoint>().anchor = Vector3.up; foot2.localScale = new Vector3(foot2.localScale.x + thickness, foot2.localScale.y, foot2.localScale.z); foot2.GetComponent <HingeJoint>().anchor = Vector3.up; //HEADS head1.localScale = Vector3.one * FeatureGenerator.remap(generatedNum[4], 0.0f, 1.0f, 0.7f, 1.5f); head2.localScale = Vector3.one * FeatureGenerator.remap(generatedNum[5], 0.0f, 1.0f, 0.7f, 1.5f); }
private void mutateWeapons() { //TODO based on something create weapon :v //Debug.Log(generatedNum[8] + " " + generatedNum[9]); //PLAYER 1 int probWeapon1 = (int)FeatureGenerator.remap(generatedNum[1], 0.0f, 1.0f, 0.0f, 100f); //probWeapon1 = 80; if (probWeapon1 <= 25) { p1Weapon = CreateWhip((int)FeatureGenerator.remap(generatedNum[9], 0.0f, 1.0f, 4.0f, 10.0f), null, GameObject.Instantiate(whipBase, Vector3.up * 10, Quaternion.identity)); } else if (probWeapon1 <= 50) { p1Weapon = CreateSword(FeatureGenerator.remap(generatedNum[8], 0.0f, 1.0f, 0.5f, 1.5f), FeatureGenerator.remap(generatedNum[9], 0.0f, 1.0f, 15.0f, 50.0f)); } else if (probWeapon1 <= 75) { p1Weapon = CreateHammer(FeatureGenerator.remap(generatedNum[8], 0.0f, 1.0f, 4f, 10f), FeatureGenerator.remap(generatedNum[9], 0.0f, 1.0f, 4f, 15.0f)); } else { p1Weapon = CreateRangedWeapon(FeatureGenerator.remap(generatedNum[8], 0.0f, 1.0f, 0.7f, 2f), FeatureGenerator.remap(generatedNum[9], 0.0f, 1.0f, 0.3f, 1.5f)); int auxBulletProb = (int)FeatureGenerator.remap(generatedNum[7], 0.0f, 1.0f, 0f, 100f); auxBulletProb = auxBulletProb <= 50 ? 0 : 1; myBullet1 = bullets[auxBulletProb]; myRangeW1 = p1Weapon.transform.GetChild(0).gameObject; StartCoroutine(startFire1()); } p1Weapon.transform.SetParent(transform); p1Weapon.transform.position = p1HandHand.transform.position; p1Weapon.transform.localRotation = Quaternion.identity; p1Weapon.transform.GetChild(0).gameObject.AddComponent <CopyTransform>().targetGO = p1HandHand.transform; //PLAYER 2 int probWeapon2 = (int)FeatureGenerator.remap(generatedNum[2], 0.0f, 1.0f, 0.0f, 100f); //probWeapon2 = 80; if (probWeapon2 <= 25) { p2Weapon = CreateWhip((int)FeatureGenerator.remap(generatedNum[9], 0.0f, 1.0f, 4.0f, 10.0f), null, GameObject.Instantiate(whipBase, Vector3.up * 10, Quaternion.identity)); } else if (probWeapon2 <= 50) { p2Weapon = CreateSword(FeatureGenerator.remap(generatedNum[8], 0.0f, 1.0f, 0.5f, 1.5f), FeatureGenerator.remap(generatedNum[9], 0.0f, 1.0f, 15.0f, 50.0f)); } else if (probWeapon2 <= 75) { p2Weapon = CreateHammer(FeatureGenerator.remap(generatedNum[8], 0.0f, 1.0f, 4f, 10f), FeatureGenerator.remap(generatedNum[9], 0.0f, 1.0f, 4f, 15.0f)); } else { p2Weapon = CreateRangedWeapon(FeatureGenerator.remap(generatedNum[7], 0.0f, 1.0f, 0.7f, 2f), FeatureGenerator.remap(generatedNum[9], 0.0f, 1.0f, 0.3f, 1.5f)); int auxBulletProb = (int)FeatureGenerator.remap(generatedNum[8], 0.0f, 1.0f, 0f, 100f); auxBulletProb = auxBulletProb <= 50 ? 0 : 1; myBullet2 = bullets[auxBulletProb]; myRangeW2 = p2Weapon.transform.GetChild(0).gameObject; StartCoroutine(startFire2()); } p2Weapon.transform.SetParent(transform); p2Weapon.transform.position = p2HandHand.transform.position; p2Weapon.transform.localRotation = Quaternion.identity; p2Weapon.transform.GetChild(0).gameObject.AddComponent <CopyTransform>().targetGO = p2HandHand.transform; p2Weapon.transform.GetChild(0).gameObject.GetComponent <CopyTransform>().mirrorY = -1; }