void Awake() { InfluenceMap.getInstance().center = new Vector2(center.x, center.z); InfluenceMap.getInstance().DefaultY = center.y; InfluenceMap.getInstance().height = height; InfluenceMap.getInstance().width = width; InfluenceMap.getInstance().htileCount = h_Tile; InfluenceMap.getInstance().wtileCount = w_Tile; InfluenceMap.getInstance().mPlane = mPlane; InfluenceMap.getInstance().Init(); GAPopulation.GlobalInit(); GAPopulationManager.getInstance().Init(); Type type = Type.GetType(DemoWorldName); aiWorld = (AIWorld)type.Assembly.CreateInstance(DemoWorldName); aiWorld.Init(); }
void Start() { GlassPopulation.AddMySelf(); CowPopulation.AddMySelf(); TreePopulation.AddMySelf(); GlassPopulation.mBreedCycle = 15.0f; GlassPopulation.mBreedor = DefaultGAFunc.SinglePointInsertBreedor; GlassPopulation.mDyingRate = 0.8f; GlassPopulation.mIncreaseRate = 1.0f / 0.6f; GlassPopulation.mMaxCount = mMaxGrass; GlassPopulation.mMutator = DefaultGAFunc.SimpleMutator; GlassPopulation.mMutatorRate = 0.005f; GlassPopulation.mObjectType = typeof(glassObject); glassObject.mpos_leftdown = glass_leftdown.transform.position; glassObject.mpos_rightup = glass_rightup.transform.position; GlassPopulation.mPlayer = GameObject.FindGameObjectWithTag("Player"); GlassPopulation.mPrefab = mGlass; GlassPopulation.mRTObjectDestroyer = new GlassDestroyer(); GlassPopulation.mRTObjectJudger = new GlassJudger(); GlassPopulation.mRTObjectRunner = new GlassRunner(); GlassPopulation.mRTType = "Glass"; GlassPopulation.mSelector = DefaultGAFunc.RouletteSelector; GlassPopulation.mSimpleAIRePairer = new GlassRePairer(); CowPopulation.mBreedCycle = 25.0f; CowPopulation.mBreedor = DefaultGAFunc.SinglePointInsertBreedor; CowPopulation.mDyingRate = 0.8f; CowPopulation.mIncreaseRate = 1 / 0.7f; CowPopulation.mMaxCount = mMaxCow; CowPopulation.mMutator = DefaultGAFunc.SimpleMutator; CowPopulation.mMutatorRate = 0.005f; CowPopulation.mObjectType = typeof(CowObject); CowObject.mpos_leftdown = cow_leftdown.transform.position; CowObject.mpos_rightup = cow_rightup.transform.position; CowPopulation.mPlayer = GameObject.FindGameObjectWithTag("Player"); CowPopulation.mPrefab = mCow; CowPopulation.mRTObjectDestroyer = new CowDestroyer(); CowPopulation.mRTObjectJudger = new CowJudger(); CowPopulation.mRTObjectRunner = new CowRunner(); CowPopulation.mRTType = "Cow"; CowPopulation.mSelector = DefaultGAFunc.RouletteSelector; CowPopulation.mSimpleAIRePairer = new CowRePairer(); TreePopulation.mBreedCycle = 25.0f; TreePopulation.mBreedor = DefaultGAFunc.SinglePointInsertBreedor; TreePopulation.mDyingRate = 0.85f; TreePopulation.mIncreaseRate = 1 / 0.75f; TreePopulation.mMaxCount = mMaxTree; TreePopulation.mMutator = DefaultGAFunc.SimpleMutator; TreePopulation.mObjectType = typeof(TreeObject); TreeObject.mpos_leftdown = tree_leftdown.transform.position; TreeObject.mpos_rightup = tree_rightup.transform.position; TreePopulation.mPlayer = GameObject.FindGameObjectWithTag("Player"); TreePopulation.mPrefab = mTree; TreePopulation.mRTObjectDestroyer = new CowDestroyer(); TreePopulation.mRTObjectJudger = new TreeJudger(); TreePopulation.mRTObjectRunner = new TreeRunner(); TreePopulation.mRTType = "Tree"; TreePopulation.mSelector = DefaultGAFunc.RouletteSelector; TreePopulation.mSimpleAIRePairer = new TreeRePairer(); GAPopulationManager.getInstance().Start(); }
void Update() { aiWorld.Update(); GAPopulationManager.getInstance().Update(); }