void Awake() { int blobCapacity = GameData.instance.blobSpawnCount; mBlobActives = new M8.CacheList <Blob>(blobCapacity); //setup pool mPool = M8.PoolController.CreatePool(poolGroup); for (int i = 0; i < templateGroups.Length; i++) { var grp = templateGroups[i]; for (int j = 0; j < grp.templates.Length; j++) { mPool.AddType(grp.templates[j], blobCapacity, blobCapacity); } } //generate spawn points mSpawnPts = new Vector2[spawnPointsRoot.childCount]; for (int i = 0; i < spawnPointsRoot.childCount; i++) { mSpawnPts[i] = spawnPointsRoot.GetChild(i).position; } if (spawnPointsShuffle) { M8.ArrayUtil.Shuffle(mSpawnPts); } mCurSpawnPtInd = 0; }
public GridEntity Spawn(GridCell cell, GridCell cellSize) { GridEntity ret = null; //ensure we can spawn on given cell info var container = GridEditController.instance.entityContainer; if (container.IsPlaceable(cell, cellSize, null)) { if (!mPool) { mPool = M8.PoolController.CreatePool(poolGroup); mPool.AddType(template, poolCapacity, poolCapacity); } if (mSpawnParms == null) { mSpawnParms = new M8.GenericParams(); } mSpawnParms[GridEntity.parmData] = this; mSpawnParms[GridEntity.parmCellIndex] = cell; mSpawnParms[GridEntity.parmCellSize] = cellSize; ret = mPool.Spawn <GridEntity>(template.name, name, container.root, mSpawnParms); } return(ret); }
void Awake() { mPool = M8.PoolController.CreatePool(poolName); mPool.AddType(template, poolCapacity, poolCapacity); mActives = new M8.CacheList <M8.PoolDataController>(activeCount); ApplyParams(); }
void Awake() { mPool = M8.PoolController.CreatePool(poolGroup); for (int i = 0; i < templates.Length; i++) { var template = templates[i]; mPool.AddType(template.name, template.template, template.capacity, template.capacity); } }
protected override void OnInstanceInit() { base.OnInstanceInit(); mGoblinPoolCtrl = M8.PoolController.GetPool(goblinPool); mGoblinPoolCtrl.AddType(goblinTemplate, goblinPts.Length, goblinPts.Length); mGoblins = new M8.CacheList <UnitEntity>(goblinPts.Length); var dragGuideGO = GameObject.FindGameObjectWithTag(tagDragGuide); mDragGuide = dragGuideGO.GetComponent <DragToGuideWidget>(); titleAnim.gameObject.SetActive(false); motionIllustrationAnim.gameObject.SetActive(false); block1ForceNetGO.SetActive(false); block1ForceGravityGO.SetActive(false); block1ForceBalancedGO.SetActive(false); block1ForceUnbalancedGO.SetActive(false); block1ForceKnightGO.SetActive(false); block1ForceGoblinGO.SetActive(false); block1NetForceDirRoot.gameObject.SetActive(false); block1NetForceNoneGO.SetActive(false); block2ForcesGO.SetActive(false); block2ForceNetGO.SetActive(false); block2ForceGravityGO.SetActive(false); block2ForceBalancedGO.SetActive(false); block2ForceUnbalancedGO.SetActive(false); block2NetForceDirRoot.gameObject.SetActive(false); block2NetForceNoneGO.SetActive(false); interfaceRootGO.SetActive(false); princessGO.SetActive(false); victoryGO.SetActive(false); block1.gameObject.SetActive(false); block1.transform.position = block1StartPt.position; for (int i = 0; i < block1Wheels.Length; i++) { var suspension = block1Wheels[i].suspension; suspension.frequency = block1WheelsAirFreq; block1Wheels[i].suspension = suspension; } block2.gameObject.SetActive(false); block2.transform.position = block2StartPt.position; signalUnitDragEnd.callback += OnSignalUnitDragEnd; }
private void Init() { if (!mIsInit) { mPool = M8.PoolController.CreatePool(poolGroup); mPool.AddType(template, capacity, capacity); points = new M8.CacheList <PointData>(capacity); mIsInit = true; } }
public void Fill(MixedNumber[] numbers) { if (!mPool) { mPool = M8.PoolController.CreatePool(cardPoolGroup); mPool.AddType(cardTemplate, cardPoolCapacity, cardPoolCapacity); } if (cards != null) { Clear(); } else { cards = new CardWidget[slotAnchors.Length]; } M8.ArrayUtil.Shuffle(numbers); count = numbers.Length; if (count > slotAnchors.Length) { count = slotAnchors.Length; } for (int i = 0; i < count; i++) { mCardParms[CardWidget.parmWholeEnabled] = cardWholeEnabled; mCardParms[CardWidget.parmNumber] = numbers[i]; mCardParms[CardWidget.parmCanDragInside] = false; mCardParms[CardWidget.parmCanDragOutside] = true; mCardParms[CardWidget.parmFractionVisual] = false; mCardParms[CardWidget.parmCardDrop] = this; mCardParms[CardWidget.parmCardDropIndex] = i; var newCard = mPool.Spawn <CardWidget>(cardTemplate.name, "", null, mCardParms); newCard.transform.SetParent(slotAnchors[i], false); newCard.transform.localPosition = Vector3.zero; cards[i] = newCard; slotAnchors[i].gameObject.SetActive(true); } for (int i = count; i < slotAnchors.Length; i++) { slotAnchors[i].gameObject.SetActive(false); } }
void Awake() { mSpawnPts = new M8.CacheList <Transform>(root.childCount); for (int i = 0; i < root.childCount; i++) { mSpawnPts.Add(root.GetChild(i)); } mPlantActives = new M8.CacheList <M8.PoolDataController>(root.childCount); mPoolCtrl = M8.PoolController.CreatePool(poolName); mPoolCtrl.AddType(template, mSpawnPts.Capacity, mSpawnPts.Capacity); signalTreeChanged.callback += OnScaleTreeChange; }
public override void Init() { base.Init(); if (!mPool) { if (entityTemplate) { mPool = M8.PoolController.CreatePool(entityPoolGroup); mPool.AddType(entityTemplate, entityCount, entityCount); mActiveUnits = new M8.CacheList <M8.EntityBase>(entityCount); } } mParms[parmDragWorld] = cursorWorld; UpdateState(); }
void Awake() { mPool = M8.PoolController.CreatePool(poolGroup); mPool.AddType(connectTemplate, capacity, capacity); //setup group mGroupActives = new M8.CacheList <Group>(groupCapacity); mGroupCache = new M8.CacheList <Group>(groupCapacity); //fill up cache for (int i = 0; i < groupCapacity; i++) { mGroupCache.Add(new Group()); } signalListenBlobDragBegin.callback += OnBlobDragBegin; signalListenBlobDragEnd.callback += OnBlobDragEnd; signalListenBlobDespawn.callback += OnBlobDespawn; signalListenBlobConnectDelete.callback += OnBlobConnectDelete; }
void Awake() { mPool = M8.PoolController.CreatePool(cardPoolGroup); mPool.AddType(cardTemplate, cardPoolCapacity, cardPoolCapacity); answerInput.submitCallback += OnInputSubmit; operandSlots.updateCallback += OnSlotUpdated; if (activeGO) { activeGO.SetActive(false); } if (dragInstruct) { mDragInstructEnabled = true; } if (dragInstructDialogGO) { dragInstructDialogGO.SetActive(false); } }
protected override void OnInstanceInit() { base.OnInstanceInit(); //spawn stuff int enterCount = spawnEnterPointsRoot.childCount; mPool = M8.PoolController.CreatePool(spawnPoolGroup); mPool.AddType(spawnTemplate, enterCount, enterCount); mEnterPoints = new Vector2[enterCount]; for (int i = 0; i < mEnterPoints.Length; i++) { mEnterPoints[i] = spawnEnterPointsRoot.GetChild(i).position; } mSpawns = new M8.CacheList <SpawnData>(enterCount); mSpawnParm = new M8.GenericParams(); mSpawnParm[UnitVelocityMoveController.parmDir] = Vector2.left; //setup boulder stuff mBoulderUnitParms[UnitEntity.parmPosition] = (Vector2)boulderUnit.transform.position; mBoulderUnitParms[UnitEntity.parmNormal] = Vector2.up; boulderUnit.gameObject.SetActive(false); // interactionGO.SetActive(false); proceedGO.SetActive(false); playUI.interactable = false; //signals signalSpawnGoalReached.callback += OnSignalSpawnReachGoal; signalProceed.callback += OnSignalProceed; }
void Awake() { mPool = M8.PoolController.CreatePool(poolGroup); mPool.AddType(template, startCapacity, maxCapacity); }
void Awake() { mPool = M8.PoolController.CreatePool(poolGroup); mPool.AddType(name, template, capacity, capacity); }