public void SendToConstructM(ConstructionManager.ConstructType _constructType, GameObject _constructPrefab, Dictionary <ItemData, int> _buildCost) { if (inputManager.GetInputMode() != InputManager.InputMode.BuildMode) { if (checkAvailableResources(_buildCost)) { inputManager.SetInputMode(InputManager.InputMode.BuildMode); constructionManager.StartPreview(_constructType, _constructPrefab); } } }
public void Initialize(Vector2 _area, float _gridSize, GameObject _constructPrefab, Map _worldMap, ConstructionManager.ConstructType _constructType) { size = _area; AddToGrid(); transform.gameObject.layer = 10; constructPrefab = _constructPrefab; constructType = _constructType; interactionRadius = ((size.x + size.y) / 2 * 1.5f) + 1.5f; IStructure structure = _constructPrefab.GetComponent <IStructure>(); //get maxhealth of the building and set it as the goal to reach maxHealth = structure.GetMaxHealth(); SetSize(_gridSize); transform.gameObject.AddComponent <BoxCollider>().size = new Vector3(size.x * _gridSize, 1.5f, size.y * _gridSize); transform.gameObject.GetComponent <BoxCollider>().center = new Vector3(0, 0.75f, 0); _worldMap.NavMeshUpdate(); }