private void f_AttemptAdoption(scr_Adopter script) { if (script.f_AreTraitsValid(m_KittySelected.GetComponent <scr_KittyMover>().f_GetTraits())) { m_Cash += 100; Destroy(script.gameObject); Destroy(m_KittySelected); f_ClearTraits(); m_Audio.f_PlayCatSell(); } }
private GameObject SpawnAdopter(int x, int y) { int numTraits = Random.Range(1, 3); GameObject newAdopter = GameObject.Instantiate(m_BaseAdopter, new Vector3(transform.position.x + x * xStep, transform.position.y + y * -yStep, 0.0f), Quaternion.identity); scr_Adopter script = newAdopter.GetComponent <scr_Adopter>(); script.f_SetNumberOfTraits(numTraits); eKittyTrait firstTrait = eKittyTrait.None; for (int i = 0; i < numTraits; ++i) { firstTrait = KittyEnums.GetRandomTrait(firstTrait); if (firstTrait != eKittyTrait.None && firstTrait != eKittyTrait.Max) { script.f_SetTrait(i, firstTrait, GameObject.Instantiate(m_KittyTraitImages[(int)firstTrait], Vector3.zero, Quaternion.identity)); } } return(newAdopter); }