// new void Awake(){ // mapItemAnimator = GetComponent<Animator> (); // // mapItemRenderer = GetComponent<SpriteRenderer> (); // // bc2d = GetComponent<BoxCollider2D> (); // this.range = new Vector2 (10, 10); // this.towards = MyTowards.Right; // bulletPool = InstancePool.GetOrCreateInstancePool ("BulletPool", CommonData.poolContainerName); // SetUpLauncher (); // } public override void InitMapItem() { bc2d.enabled = true; SetUpLauncher(); SetSortingOrder(-(int)transform.position.y); bulletPool = InstancePool.GetOrCreateInstancePool("BulletPool", CommonData.poolContainerName); }
void Awake() { Transform poolContainerOfBagCanvas = TransformManager.FindOrCreateTransform(CommonData.poolContainerName + "/PoolContainerOfBagCanvas"); //创建缓存池 bagItemsPool = InstancePool.GetOrCreateInstancePool("BagItemsPool", poolContainerOfBagCanvas.name); }
public override void AddToPool(InstancePool pool) { // attachedItem = null; bc2d.enabled = false; gameObject.SetActive(false); pool.AddInstanceToPool(this.gameObject); }
/// <summary> /// 初始化记录页面 /// </summary> /// <param name="learnInfo">Learn info.</param> /// <param name="tabIndex">选项卡序号 【0:基本信息 1:错误单词】.</param> public void SetUpRecordView(LearningInfo learnInfo) { this.learnInfo = learnInfo; // 创建缓存池 wordPool = InstancePool.GetOrCreateInstancePool("WordItemPool", CommonData.poolContainerName); SetUpGeneralLearningInfo(); GetComponent <Canvas>().enabled = true; }
public static InstancePool GetOrCreateInstancePool(string poolName, string parentName) { Transform trans = TransformManager.FindOrCreateTransform(parentName + "/" + poolName); InstancePool instancePool = trans.GetComponent <InstancePool> (); if (instancePool == null) { instancePool = trans.gameObject.AddComponent <InstancePool> (); } return(instancePool); }
public override void AddToPool(InstancePool pool) { bc2d.enabled = false; //DisableAllDetect(); if (delayMoveCoroutine != null) { StopCoroutine(delayMoveCoroutine); } //StopCoroutine("DelayedMovement"); pool.AddInstanceToPool(this.gameObject); StopMoveImmidiately(); gameObject.SetActive(false); pool.AddInstanceToPool(this.gameObject); }
/// <summary> /// 加入缓存池 /// </summary> /// <param name="pool">Pool.</param> public override void AddToPool(InstancePool pool) { StopMoveImmidiately(); if (delayMoveCoroutine != null) { StopCoroutine(delayMoveCoroutine); } DisableAllDetect(); isReadyToFight = false; HideAllAlertAreas(); bc2d.enabled = false; gameObject.SetActive(false); pool.AddInstanceToPool(this.gameObject); }
public void InitLearnView(int totalWordsCount) { crystalHarvestCount.text = "0"; UpdateLearningProgress(0, totalWordsCount, false); totalTurnCount = 0; isShowRightAnswerFinished = true; crystalPool = InstancePool.GetOrCreateInstancePool("CrystalPool", CommonData.poolContainerName); SetUpBasicInformation(); }
public void AddToPool(InstancePool pool) { this.boxCollider.enabled = false; this.gameObject.SetActive(false); int posX = Mathf.RoundToInt(oriPos.x); int posY = Mathf.RoundToInt(oriPos.y); ExploreManager.Instance.newMapGenerator.mapWalkableInfoArray[posX, posY] = 1; characterSmallDetect.SetBoxColliderEnable(false); pool.AddInstanceToPool(this.gameObject); }
public void InitVerticalScrollViewData(List <object> dataList, InstancePool cellPool, Transform cellModel) { this.allDataList = dataList; this.cellPool = cellPool; this.cellModel = cellModel; totalModelCount = dataList.Count; scrollViewPortHeight = (transform as RectTransform).rect.height; cellHeight = (cellModel as RectTransform).rect.height; VerticalLayoutGroup layout = scrollContentContainer.GetComponent <VerticalLayoutGroup> (); paddingY = layout.spacing; topOffsetY = layout.padding.top; // bottomOffsetY = layout.padding.bottom; maxCellsVisible = (int)(scrollViewPortHeight / (cellHeight + paddingY) + 2); }
void Awake() { this.choiceButtonPool = InstancePool.GetOrCreateInstancePool("NPCChoiceButtonPool", CommonData.exploreScenePoolContainerName); this.goodsPool = InstancePool.GetOrCreateInstancePool("NPCGoodsPool", CommonData.exploreScenePoolContainerName); }
public void InitExploreAgentView() { statusTintPool = InstancePool.GetOrCreateInstancePool("StatusTintPool", CommonData.exploreScenePoolContainerName); fightTextPool = InstancePool.GetOrCreateInstancePool("FightTextPool", CommonData.exploreScenePoolContainerName); fightTextManager.InitFightTextManager(fightTextPool, fightTextModel, fightTextContainer); }
public override void AddToPool(InstancePool pool) { pool.AddInstanceToPool(this.gameObject); }
/// <summary> /// 在地图上生成奖励物品 /// </summary> /// <param name="reward">Reward.</param> /// <param name="rewardPosition">Reward position.</param> /// <param name="rewardPool">Reward pool.</param> public void SetUpRewardInMap(Item reward, Vector3 rewardPosition, InstancePool rewardPool) { this.reward = reward; this.rewardPool = rewardPool; sr.sprite = GameManager.Instance.gameDataCenter.GetGameItemSprite(reward); transform.position = new Vector3(rewardPosition.x, rewardPosition.y, rewardPosition.z); sr.transform.position = new Vector3(rewardPosition.x, rewardPosition.y + 0.5f, rewardPosition.z); sr.sortingOrder = -Mathf.RoundToInt(rewardPosition.y); gameObject.SetActive(true); // 检查人物背包是否已经满了 bool bagFull = Player.mainPlayer.CheckBagFull(reward); bool npcCanvasOnTop = false; Canvas npcCanvas = TransformManager.FindTransform("NPCCanvas").GetComponent <Canvas>(); npcCanvasOnTop = npcCanvas.enabled; // 背包满了 if (bagFull) { // 提示背包已满 if (npcCanvasOnTop) { npcCanvas.GetComponent <NPCViewController>().tintHUD.SetUpSingleTextTintHUD("背包已满"); } else { ExploreManager.Instance.expUICtr.SetUpSingleTextTintHUD("背包已满"); } bc2d.enabled = true; // 奖励物品在地图上漂浮 if (rewardFloatCoroutine != null) { StopCoroutine(rewardFloatCoroutine); } rewardFloatCoroutine = RewardFloat(); StartCoroutine(rewardFloatCoroutine); ExploreManager.Instance.newMapGenerator.mapWalkableInfoArray[Mathf.RoundToInt(rewardPosition.x), Mathf.RoundToInt(rewardPosition.y)] = 2; } else { // 玩家获得物品 if (!npcCanvasOnTop) { ExploreManager.Instance.ObtainReward(reward); } bc2d.enabled = false; // 物品飞向玩家 RewardFlyToPlayer(delegate { AddToPool(rewardPool); ExploreManager.Instance.expUICtr.UpdateBottomBar(); }, true); } }
public void SetPool(InstancePool pool) { this.characterFragmentPool = pool; }
//private InstancePool wordPool; public void InitWordItemView(CallBackWithWord changeStatusButtonClickCallBack, CallBack showWordDetailCallBack, InstancePool wordPool) { this.changeStatusButtonClickCallBack = changeStatusButtonClickCallBack; this.showWordDetailCallBack = showWordDetailCallBack; //this.wordPool = wordPool; }
public void BulletMove(Vector3 launcherPos, MyTowards towards, Vector2 range, InstancePool bulletPool) { this.bulletPool = bulletPool; Vector3 bulletLaunchPos = Vector3.zero; switch (towards) { case MyTowards.Left: bulletLaunchPos = launcherPos + new Vector3(-0.5f, 0, 0); break; case MyTowards.Right: bulletLaunchPos = launcherPos + new Vector3(0.5f, 0, 0); break; case MyTowards.Up: bulletLaunchPos = launcherPos + new Vector3(0, 0.5f, 0); break; case MyTowards.Down: bulletLaunchPos = launcherPos + new Vector3(0, -0.5f, 0); break; } this.transform.position = bulletLaunchPos; bc2d.enabled = true; bulletMoveCoroutine = BulletMoveWithMoveVectorAndRange(towards, range); StartCoroutine(bulletMoveCoroutine); }
public void InitCharactersInBagHUD() { characterPool = InstancePool.GetOrCreateInstancePool("CharacterPool", CommonData.poolContainerName); }
void Awake() { consumablesButtonPool = InstancePool.GetOrCreateInstancePool("ConsumablesButtonPool", CommonData.exploreScenePoolContainerName); }
public void AddToPool(InstancePool pool) { boxCollider.enabled = false; gameObject.SetActive(false); pool.AddInstanceToPool(this.gameObject); }
public void InitUnlockedItemView() { unlockedItemsPool = InstancePool.GetOrCreateInstancePool("UnlockedItemPool", CommonData.poolContainerName); }
/// <summary> /// 初始化文本动画控制器 /// </summary> /// <param name="exploreTextPool">Explore text pool.</param> /// <param name="exploreTextModel">Explore text model.</param> /// <param name="exploreTextContainer">Explore text container.</param> public void InitExploreTextManager(InstancePool exploreTextPool, Transform exploreTextModel, Transform exploreTextContainer) { this.exploreTextPool = exploreTextPool; this.exploreTextModel = exploreTextModel; this.exploreTextContainer = exploreTextContainer; }
/// <summary> /// 加入缓存池 /// </summary> /// <param name="pool">Pool.</param> public abstract void AddToPool(InstancePool pool);
public void InitFightTextManager(InstancePool fightTextPool, Transform fightTextModel, Transform fightTextContainer) { this.fightTextPool = fightTextPool; this.fightTextModel = fightTextModel; this.fightTextContainer = fightTextContainer; }
void Awake() { recipesItemPool = InstancePool.GetOrCreateInstancePool("RecipesItemPool", CommonData.bagCanvasPoolContainerName); }
public override void AddToPool(InstancePool pool) { bc2d.enabled = false; pool.AddInstanceToPool(this.gameObject); }
public override void AddToPool(InstancePool pool) { }