void Awake() { InvManager = FindObjectOfType(typeof(InventoryManager)) as InventoryManager; //Get the Inventory Manager object/script. InvEquipment = FindObjectOfType(typeof(Equipment)) as Equipment; //Get the Equipment script. InvSkillBar = FindObjectOfType(typeof(SkillBar)) as SkillBar; //Get the skill bar script. CustomEvents = FindObjectOfType(typeof(InventoryEvents)) as InventoryEvents; InvVendor = FindObjectOfType(typeof(VendorUI)) as VendorUI; InvCraft = FindObjectOfType(typeof(CraftManager)) as CraftManager; InvContainer = FindObjectOfType(typeof(ContainerUI)) as ContainerUI; InvEquipmentUI = FindObjectOfType(typeof(EquipmentUI)) as EquipmentUI; InvItemGroup = FindObjectOfType(typeof(ItemGroupUI)) as ItemGroupUI; //Setting up rect transforms: UICanvasTrans = UICanvas.GetComponent <RectTransform>(); PanelTrans = Panel.GetComponent <RectTransform>(); SetInvPosition(); // Set the default position of the inventory backdrop. CreateRiches(); //Set all riches slots. ActionMenu.gameObject.SetActive(false); DropMenu.gameObject.SetActive(false); ShowInv = false; // Panel.SetActive(false); //--hide at start }
public void init() { gm = GameManager.gm; bm = gm.getBoardManager(); cm = gm.getCraftManager(); rm = gm.getResearchManager(); player = gm.getPlayer(); }
private void Awake() { for (int i = 0; i < 20; i++) { Slots[i] = new InventorySlot(); } craftManager = ManagerObject.GetComponent <CraftManager>(); }
void Awake() { if (instance == null) { instance = this; } else if (instance != null) { Destroy(gameObject); } }
public Base(int id) { gm = GameManager.gm; cm = gm.getCraftManager(); player = gm.getPlayer(); this.id = id; cultivatingList = new List <CultivateElement>(); doneList = new List <CultivateElement>(); inventory = new List <InventoryElement>(); }
private void Awake() { gm = GameManager.gm; player = gm.getPlayer(); cm = gm.getCraftManager(); bm = gm.getBoardManager(); rm = gm.getResearchManager(); makeCraftList(); gameObject.SetActive(false); }
private CraftManager GetGameWinner() { for (int i = 0; i < crafts.Length; i++) { if (crafts[i].m_Wins == numRoundsToWin) { winner = crafts[i]; return(crafts[i]); } } return(null); }
//private void Awake() { // gm = GameManager.gm; // cm = gm.getCraftManager(); // player = gm.getPlayer(); //} // initialize name, ingredients, icon public void init(Recipe recipe) { panel = GetComponentInParent <CraftPanel>(); gm = GameManager.gm; cm = gm.getCraftManager(); rm = gm.getResearchManager(); player = gm.getPlayer(); this.recipe = recipe; name.text = this.recipe.getProduct().item.getName() + " x " + this.recipe.getProduct().count.ToString(); ingredients.text = generateIngredientsText(this.recipe.getIngredients()); requirements.text = generateRequirementsText(this.recipe); icon.sprite = recipe.getProduct().item.getIcon(); }
public void InitializeRecipe(CraftRecipe craft, CraftManager manager) { _recipe = craft; _manager = manager; var x = -60; foreach (var recipeItem in craft.Recipe) { AddItem(recipeItem, x); x += 40; } AddItem(craft.Result, 60); SetAvailability(manager.Available(craft)); }
private void Awake() { // if the singleton hasn't been initialized yet if (instance != null && instance != this) { Destroy(this); return; } instance = this; isOpen = false; if (craftInfos == null) { craftInfos = new List <CraftInfo>(); } inventory = new Inventory(nbColumns, nbLines); DontDestroyOnLoad(this.gameObject); }
public void Start() { Craft = new CraftManager(this); GameManager = gameManager.GetComponent <GameManager>(); World = GameManager.World; _statusManager = GameObject.FindGameObjectWithTag("StatusManager") .GetComponent <UIStatusManager>(); Entities = GameObject.FindGameObjectWithTag("EntityManager") .GetComponent <EntityManager>(); Controller = GetComponent <CharacterController>(); _animator = GetComponent <Animator>(); _animMove = Animator.StringToHash("Move"); _animAttack = Animator.StringToHash("IsAttack"); }
public void onClick() { gm = GameManager.gm; cm = gm.getCraftManager(); bm = gm.getBoardManager(); player = gm.getPlayer(); player.addItem(1, 10); player.addItem(3, 10); player.addItem(4, 10); player.addItem(5, 10); player.addItem(5, 10); player.addItem(6, 10); player.addItem(7, 10); player.addItem(8, 10); player.addItem(15, 1); player.addItem(105, 10); player.addItem(300, 100); }
public void CheckCraft() { CraftManager craftManager = GameObject.FindGameObjectWithTag("CraftManager").GetComponent <CraftManager>(); foreach (Recipe recipe in playerInventory.knownRecipes) { Item item = craftManager.GetCraftItem(craftItems, recipe); if (item != null) { craftedItem.GetComponent <ItemContainer>().item = item; craftedItem.transform.Find("ItemIcon").gameObject.GetComponent <Image>().sprite = item.icon; craftedItemInfo.GetComponent <Text>().text = item.GetInfo(); currentRecipe = recipe; return; } } craftedItem.GetComponent <ItemContainer>().item = null; craftedItem.transform.Find("ItemIcon").GetComponent <Image>().sprite = null; craftedItemInfo.GetComponent <Text>().text = ""; }
void Awake() { InvManager = FindObjectOfType(typeof(InventoryManager)) as InventoryManager; //Get the Inventory Manager object/script. InvCraft = FindObjectOfType(typeof(CraftManager)) as CraftManager; //Get the Equipment script. CustomEvents = FindObjectOfType(typeof(InventoryEvents)) as InventoryEvents; //Setting up rect transforms: UICanvasTrans = UICanvas.GetComponent <RectTransform>(); PanelTrans = Panel.GetComponent <RectTransform>(); SetCraftPosition(); Panel.SetActive(false); //Set craft slots: if (CraftSlots.Length > 0) { for (int i = 0; i < CraftSlots.Length; i++) { CraftSlots[i].EmptySlot.gameObject.GetComponent <SlotUI>().SlotID = i; } } //Set Recipe IDs: if (RecipeButtons.Length > 0) { for (int a = 0; a < RecipeButtons.Length; a++) { RecipeButtons[a].GetComponent <SlotUI>().SlotID = a; InvCraft.Recipes[a].ItemReady = false; InvCraft.Recipes[a].Timer = 0; } } RefreshItems(); BarWidth = FullBar.rect.width; PosX = FullBar.localPosition.x; }
private IEnumerator RoundEnding() { DisableCraftControl(); roundWinner = null; roundWinner = GetRoundWinner(); if (roundWinner != null) { roundWinner.m_Wins++; } gameWinner = GetGameWinner(); string message = EndMessage(); messageText.text = message; yield return(endWait); }
private void Start() { if (slots.Count != slotsUI.Count) { Debug.LogError("Inventory size doesn't fit with inventory UI", gameObject); } for (int i = 0; i < slots.Count; ++i) { slots[i].SetInventory(this); slotsUI[i].Init(slots[i]); } woodsSlot.SetInventory(this); woodsSlotUI.Init(woodsSlot); mealSlot.SetInventory(this); mealSlotUI.Init(mealSlot); cm = new CraftManager(); // todo error if (buttonCraft == null) { buttonCraft = GameObject.Find("ButtonFurnace").GetComponent <Button>(); } //buttonCraft.onClick.AddListener(Craft); }
private void Start() { gm = GameManager.gm; cm = gm.getCraftManager(); map = gm.getBoardManager().getMap(); }
void Update() { if (Input.GetMouseButtonUp(1)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity)) { if (hit.collider.tag == TurnManager.CurrentTeam) { if (!hit.collider.GetComponent <TacticsMove>().turn&& !hit.collider.GetComponent <TacticsMove>().passedTurn) { TurnManager.CurrentSelected.EndTurn(); hit.collider.GetComponent <TacticsMove>().BeginTurn(); TacticsMove currentTm = hit.collider.GetComponent <TacticsMove>(); TurnManager.CurrentSelected = currentTm; currentTm.BeginTurn(); currentTm.MoveAction(); if (equipmentDisplay.isActiveAndEnabled) { equipmentDisplay.UpdateEquipment(true); } } } } } if (Input.GetKeyDown(KeyCode.C)) { CraftManager.UpdateRecipes(); GetComponent <Recipe>().Craft(); } if (camFollow && TurnManager.CurrentTeam == "Player") { newCameraPos = new Vector3(newCameraPos.x, cameraBase.transform.position.y, newCameraPos.z); cameraBase.transform.position = Vector3.MoveTowards(cameraBase.transform.position, newCameraPos, cameraBase.GetComponent <CameraControl>().panSpeed); if (cameraBase.transform.position == newCameraPos) { camFollow = false; } } if (!TurnManager.combatInitialized) { if (TurnManager.UnitList.Count > 0) { TurnManager.InitCombat(); follow = true; } else { follow = false; } } if (follow) { transform.position = TurnManager.CurrentSelected.transform.position + new Vector3(0, 2, 0); } }
private void OnAvailRecipeChange(CraftManager manager) { UpdateRecipes(); }
private void initGame() { /* * Initializing player * */ player = new Player(100, 1000, 0, 100f); /* * Initializing Databases * */ itemText = Resources.Load("Data/Item") as TextAsset; recipeText = Resources.Load("Data/Recipe") as TextAsset; techText = Resources.Load("Data/Technology") as TextAsset; ItemDatabase.init(itemText); RecipeDatabase.init(recipeText); TechnologyDatabase.init(techText); FieldDropDatabase.init(); /* * Other Managers Initializing * * **CAUTION** * You must initialize managers after initializing databases, player * because initializing managers contain loading object, data from database, player * also, order of initializing managers also matters */ researchManager = GetComponent <ResearchManager>(); researchManager.init(); // craftManager references researchManager craftManager = GetComponent <CraftManager>(); craftManager.init(); // boardManager = GetComponent <BoardManager>(); boardManager.init(); soundManager = GetComponentInChildren <SoundManager>(); /* * Effect Processor Initializing * **CAUTION** * You must initialize this after all other initializing done */ effectProcessor = new EffectProcessor(); effectProcessor.init(); ///* // * get Inventory // */ //inventory = transform.Find("Canvas/InventoryPanel").gameObject; // default scene scene = SCENES.BASE; // game play variables initialize day = 1; exploreChance = true; moveChance = true; researchChance = true; // start game SceneManager.LoadScene(scene); }
public CraftButton(int id) { recipeId = id; cm = GameManager.gm.getCraftManager(); }
void Awake() { Instance = this; }
private void Awake() { Instance = this; }