private void CreatePrefab(GameObject prefab, Vector3 worldPos, Vector3 offset) { worldPos = BuildGrid.WorldToGridCenter(worldPos); worldPos.y = prefab.transform.position.y; worldPos += offset; Quaternion rotation = prefab.transform.rotation; Instantiate(prefab, worldPos, rotation); }
private void CreatePrefab(GameObject prefab, Vector3 worldPos, Vector3 scale) { worldPos = BuildGrid.WorldToGridCenter(worldPos); worldPos.y = prefab.transform.position.y; scale.y = prefab.transform.lossyScale.y; instantiatedField = (GameObject)Instantiate(prefab, worldPos, Quaternion.identity); instantiatedField.transform.localScale = scale; instantiatedField.transform.parent = transform; instantiatedField.SetActive(!requiresPower); }
private void CreatePrefab(GameObject prefab, Vector3 worldPos) { worldPos = BuildGrid.WorldToGridCenter(worldPos); worldPos.y = prefab.transform.position.y; Instantiate(prefab, worldPos, Quaternion.identity); }
private void SetDestination(Vector3 worldPos) { destination = BuildGrid.WorldToGridCenter(worldPos); destination.y = transform.position.y; transform.LookAt(destination); }
private void FixPostion() { destination = BuildGrid.WorldToGridCenter(transform.position); destination.y = transform.position.y; transform.position = destination; }
private void moveTo(Vector3 worldPos) { worldPos.y = transform.position.y; worldPos = BuildGrid.WorldToGridCenter(worldPos); transform.position = worldPos; }