private void SpawnBubbleOn(string dialogText, Transform target, float readTime, string title = "") { BubbleDialog b = bubblePool.SpawnTargetObject(bubbleObj, 3).GetComponent <BubbleDialog>(); b.transform.position = target.transform.position + new Vector3(0, bubbleOffsetY, 0); b.InitBubble(dialogText, readTime, title); }
public void Reward(PoolContainer pooler, Vector3 spawnPosition) { PoolObject po = pooler.SpawnTargetObject(reward.thisPoolObject, 2); po.transform.position = spawnPosition; rewarded = true; questUpdateEvent.Raise(); }
private BubbleDialog SpawnBubbleOn(string dialogText, Transform target, float readTime) { BubbleDialog b = bubblePool.SpawnTargetObject(bubbleObj, 3).GetComponent <BubbleDialog>(); b.transform.position = target.transform.position + new Vector3(0, bubbleOffsetY, 0); b.InitBubble(dialogText, readTime); currentBubble = b; return(b); }
public override void InitializeProjectile(SkillUser user) { float currentAngle = 0; while (currentAngle < 360) { PoolObject p = pool.SpawnTargetObject(iceShardPrefab, 20); p.GetComponent <ProjectileObject>().InitializeProjectile(user); p.transform.position = transform.position; p.transform.rotation = Quaternion.Euler(0, 0, currentAngle); currentAngle += angleBetweenShards; } }
private void TryToInsertItem(QuestArc targetQuest) { for (int i = itemList.Count - 1; i >= 0; i--) { if (itemList[i].targetQuest == targetQuest) { itemList[i].UpdateItem(targetQuest, this); return; } } QuestHUDItem item = pooler.SpawnTargetObject(hudItem, 10, itemContainer).GetComponent <QuestHUDItem>(); itemList.Add(item); item.UpdateItem(targetQuest, this); }
public void SpawnPrefabs() { int targetAmount = Mathf.RoundToInt(Random.Range(amountConstraints.x, amountConstraints.y)); for (int i = 0; i < targetAmount; i++) { PoolObject po = pooler.SpawnTargetObject(targetPrefab, amountToPool, transform); po.transform.position = transform.position; float targetForce = Random.Range(forceConstraints.x, forceConstraints.y); Rigidbody2D rb = po.GetComponent <Rigidbody2D>(); if (rb) { rb.AddForce(targetForce * Random.insideUnitCircle, ForceMode2D.Impulse); } } }
public void RoomCleared() { //spawnar recompensa e abrir portas if (!playerObject) { return; } if (currentReward) { Reward rr = pooler.SpawnTargetObject(currentReward.thisPoolObject, 1, transform).GetComponent <Reward>(); rr.transform.position = playerObject.transform.position; } for (int i = 0; i < currentDeco.doors.Length; i++) { currentDeco.doors[i].SetLocked(false); } }
public void SetupMenu(Race raceToUpgrade, int astralMapIndex, PlayerStats player) { if (raceToUpgrade.augments == null || raceToUpgrade.augments.Length <= 0) { return; } playerStats = player; for (int i = 0; i < augmentPanelsContainer.childCount; i++) { augmentPanelsContainer.GetChild(i).gameObject.SetActive(false); } gameObject.SetActive(true); for (int i = 0; i < raceToUpgrade.augments.Length; i++) { AugmentMenuItem menuItem; menuItem = pooler.SpawnTargetObject(augmentMenuItem, 5, augmentPanelsContainer).GetComponent <AugmentMenuItem>(); menuItem.SetupAugmentMenuItem(raceToUpgrade.augments[i], this); } menuHeader.text = "Choose an augment for the " + raceToUpgrade.magicSkill.skillName + " skill."; Time.timeScale = 0; }
public void UpdateStateBar(EntityStats owner) { for (int i = 0; i < iconContainer.childCount; i++) { iconContainer.GetChild(i).gameObject.SetActive(false); } if (owner.states == null && owner.states.Count <= 0) { return; } for (int i = 0; i < owner.states.Count; i++) { for (int y = 0; y < owner.states[i].stackAmount; y++) { if (owner.states[i].currentState.stateIcon == null) { continue; } StateIcon ic = iconPooler.SpawnTargetObject(iconPrefab, 10, iconContainer).GetComponent <StateIcon>(); //ic.transform.parent = iconContainer; ic.SetUpIcon(owner.states[i].currentState.stateIcon); } } }
public void UpdateCategory() { float containerHeight = originalHeight; float itemHeight = itemPrefab.GetComponent <QuestMenuItem>().rect.rect.height; float currentY = (containerHeight + verticalOffset) * -1; //if player completed a quest and it should no longer be here, remove it for (int i = itemList.Count - 1; i >= 0; i--) { QuestMenuItem item = itemList[i]; if ((!displayCompleted && item.targetQuest.rewarded) || (!displayActive && !item.targetQuest.rewarded)) { itemList.Remove(item); item.gameObject.SetActive(false); } } if (questsToDisplay.quests == null) { return; } //check if quest to add is already here and if not, add it for (int i = 0; i < questsToDisplay.quests.Count; i++) { if ((displayActive && !questsToDisplay.quests[i].rewarded) || (displayCompleted && questsToDisplay.quests[i].rewarded)) { bool found = false; for (int y = 0; y < itemList.Count; y++) { if (itemList[y].targetQuest == questsToDisplay.quests[i]) { found = true; } } if (!found) { Debug.Log("Created Quest Menu Item"); QuestMenuItem item = pooler.SpawnTargetObject(itemPrefab, 10, transform).GetComponent <QuestMenuItem>(); item.rect.anchoredPosition = new Vector2(horizontalOffset, currentY); itemList.Add(item); item.SetupItem(questsToDisplay.quests[i], questMenu); item.gameObject.SetActive(false); } } } //update positions for active quests that always appear before completed ones if (displayActive) { for (int i = itemList.Count - 1; i >= 0; i--) { if (!itemList[i].targetQuest.rewarded) { itemList[i].gameObject.SetActive(true); itemList[i].rect.anchoredPosition = new Vector2(horizontalOffset, currentY); currentY -= itemHeight + verticalOffset; } } } //update pos for completed if (displayCompleted) { for (int i = itemList.Count - 1; i >= 0; i--) { if (itemList[i].targetQuest.rewarded) { itemList[i].gameObject.SetActive(true); itemList[i].rect.anchoredPosition = new Vector2(horizontalOffset, currentY); currentY -= itemHeight + verticalOffset; } } } if (open) { Open(true, false); } }