/// <summary> /// Register for any interested events. /// </summary> public override void Awake() { base.Awake(); m_ItemSetManager = m_GameObject.GetCachedComponent <ItemSetManager>(); // If the CategoryID is 0 then the category hasn't been initialized. Use the first category index. if (m_ItemSetCategoryID == 0 && m_ItemSetManager.CategoryItemSets.Length > 0) { m_ItemSetCategoryID = m_ItemSetManager.CategoryItemSets[0].CategoryID; } m_ItemSetCategoryIndex = m_ItemSetManager.CategoryIDToIndex(m_ItemSetCategoryID); var equipUnequipAbilities = GetAbilities <EquipUnequip>(); if (equipUnequipAbilities != null) { // The ItemSet CategoryID must match for the ToggleEquip ability to be able to use the EquipUnequip ability. for (int i = 0; i < equipUnequipAbilities.Length; ++i) { if (equipUnequipAbilities[i].ItemSetCategoryID == m_ItemSetCategoryID) { m_EquipUnequipItemAbility = equipUnequipAbilities[i]; break; } } } }
/// <summary> /// Initialize the default values. /// </summary> public override void Awake() { base.Awake(); m_ItemSetManager = m_GameObject.GetCachedComponent <ItemSetManager>(); m_Items = new Item[m_SlotID == -1 ? m_Inventory.SlotCount : 1]; EventHandler.RegisterEvent(m_GameObject, "OnAnimatorDropItem", DropItem); if (m_ItemSetManager != null) { EventHandler.RegisterEvent <Item, int>(m_GameObject, "OnAbilityUnequipItemComplete", OnUnequipItem); } }
void ConstructManagers() { AStar.RegisterWorld(worldMgr); ItemMgr = new ItemSetManager(); //structureMgr = new StructureManager(); //shapeMgr = new ShapeManager(); //textureAndMaterialMgr = new TextureAndMaterialManager(); threadMgr = new ThreadManager(maxThreads, updatesPerTick); worldMgr = new WorldManager(chunksTall, radius); entityMgr = new EntityManager(); }
public Block GetNeighborByBlock(int x, int y, int z, Direction dir) { Vector3Int neighborCoord = Vector3Int.GetNeighborByVector3Int(x, y, z, dir); if (neighborCoord.x < 0 || neighborCoord.x >= ChuchMaxWidth || neighborCoord.y < 0 || neighborCoord.y >= ChuchMaxHight || neighborCoord.z < 0 || neighborCoord.z >= ChuchMaxWidth) { return(ItemSetManager.GetBlockType("Air")); } else { return(blockData[neighborCoord.x, neighborCoord.y, neighborCoord.z]); } }
/// <summary> /// Initialize the default values. /// </summary> public override void Awake() { base.Awake(); m_EquipUnequipAbilities = m_CharacterLocomotion.GetAbilities <EquipUnequip>(); if (m_EquipUnequipAbilities == null || m_EquipUnequipAbilities.Length == 0) { Debug.LogError("Error: At least one EquipUnequip ability must be added to the character in order for the ItemEquipVerifier ability to work."); Enabled = false; return; } m_ItemSetManager = m_GameObject.GetCachedComponent <ItemSetManager>(); m_StartingItemSetIndex = new int[m_EquipUnequipAbilities.Length]; m_TargetItemSetIndex = new int[m_EquipUnequipAbilities.Length]; EventHandler.RegisterEvent <Vector3, Vector3, GameObject>(m_GameObject, "OnDeath", OnDeath); }
public Block GetBlockAt(float x, float y, float z) { Chunk ch; Block block; if (GetChunkAt(x, y, z, out ch)) { //Debug.Log("chunk " + ch.position.ToString()); if (ch.GetBlockAt((int)x, (int)y, (int)z, out block)) { return(block); } } return(ItemSetManager.GetBlockType("Air")); }
public override void EventStart(string text) { //種を植える if (text == events[0].eventText) { menu.SendMenuButton("ItemSet"); menu.MenuManagerB.Open(pos); ItemSetManager setM = (ItemSetManager)menu.MenuManagerB; setM.TypeSet(ItemType.Seed); } //肥料をあげる if (text == events[1].eventText) { menu.SendMenuButton("ItemSet"); menu.MenuManagerB.Open(pos); ItemSetManager setM = (ItemSetManager)menu.MenuManagerB; setM.TypeSet(ItemType.Fertilizer); } //水やり if (text == events[2].eventText) { field.GetPlantData(pos).soilWaterValue = 100; field.GetPlantData(pos).soilState = Soil.VeryMoist; menu.State = MenuState.None; MainManager.GetInstance.Particle.PaticleMake(MainManager.GetInstance.Particle.Particle[1], pp); DontDestroyManager.my.Sound.PlaySE("Water"); } //収穫 if (text == events[3].eventText) { field.Harvest(pos); menu.State = MenuState.None; MainManager.GetInstance.Particle.PaticleMake(MainManager.GetInstance.Particle.Particle[0], pp); DontDestroyManager.my.Sound.PlaySE("Dig"); } if (text == "None") { menu.State = MenuState.None; } MenuClose(); view.PlantVSetActive(false); MapEventManager.GetInstance().buttonPressd = false; }
public bool GetBlockAt(int x, int y, int z, out Block block) { x = negToPos(x); y = negToPos(y); z = negToPos(z); if ((flags & ChunkFlags.HasBlocks) == 0) { block = ItemSetManager.GetBlockType("Air"); return(false); } if (IsWithInBounds(x, y, z)) { block = blockData[x, y, z]; return(true); } block = ItemSetManager.GetBlockType("Air"); return(false); }
protected override void ThreadFunction() { isAir = true; int heightSacale = 6; int seed = GameManager._seed; float detailScale = 15.0f; int fixX = chunk.position.x * Chunk.ChuchMaxWidth + seed; int fixY = chunk.position.y * Chunk.ChuchMaxHight; int fixZ = chunk.position.z * Chunk.ChuchMaxWidth + seed; for (int x = 0; x < Chunk.ChuchMaxWidth; x++) { for (int y = 0; y < Chunk.ChuchMaxHight; y++) { for (int z = 0; z < Chunk.ChuchMaxWidth; z++) { int value = (int)(Mathf.PerlinNoise((x + fixX) / detailScale, (z + fixZ) / detailScale) * heightSacale) + 4; int comV = (int)(y + fixY); if ((y + fixY) < value && isAir) { isAir = false; } if (comV > value) { cons[x, y, z] = ItemSetManager.GetBlockType("Air"); //float randX = UnityEngine.Random.Range(1, 100); //if (comV == value + 1 && randX == 1) { //StructureGenerator.GenRockSpike(position, x, y, z, cons); //} continue; } if (comV <= value) { cons[x, y, z] = ItemSetManager.GetBlockType("Stone"); } if (comV > value - 2) { cons[x, y, z] = ItemSetManager.GetBlockType("Dirt"); } if (comV == value) { cons[x, y, z] = ItemSetManager.GetBlockType("Grass"); } } } } //StructureGenerator.GetWaitingBlocks(position, cons); //isAir = true; //lightSourceIndices = new List<int>(); //blocks = new Block[Chunk.size * Chunk.size * Chunk.size]; //float caveTuning = (Mathf.Sin((chunk.position.x / 256f)) + 3.5f); //int idx = 0; //for (int x = 0; x < Chunk.size; x++) { // for (int y = 0; y < Chunk.size; y++) { // for (int z = 0; z < Chunk.size; z++) { // int _X = x + chunk.position.x + GameManager._seed; // int _Z = z + chunk.position.z + GameManager._seed; // float height = Mathf.PerlinNoise((_X) / 64f + 756, (_Z) / 64f) * 16f // + Mathf.PerlinNoise((_X) / 16f - 5778, (_Z) / 16f +78) * 4f // + Mathf.PerlinNoise((_X) / 256f, (_Z) / 256f + 567) * 96f // + Mathf.PerlinNoise((_X) / 128f - 7798, (_Z) / 64f +120) * 48f // + Mathf.PerlinNoise((_X) / 64f, (_Z) / 96f + 4800) * 32f // + Mathf.PerlinNoise((_X) / 256f + 846, (_Z) / 128f + 12) * 72f // + 160f; // if (y + chunk.position.y < height) { // if (GetNoise3D(_X, y + chunk.position.y, _Z) < caveTuning) { // blocks[idx].value = 0x20; // isAir = false; // } // } // idx++; // } // } //} }
/// <summary> /// Update the slot count on first run. /// </summary> public void OnEnable() { m_ItemSetManager = target as ItemSetManager; m_InventoryBase = m_ItemSetManager.GetComponent <InventoryBase>(); }
/// <summary> /// Initialize the default values. /// </summary> public override void Awake() { base.Awake(); m_ItemSetManager = m_GameObject.GetCachedComponent <ItemSetManager>(); }