Пример #1
0
    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);
    }
Пример #2
0
    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);
    }
Пример #3
0
 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;
 }
Пример #6
0
 private void moveTo(Vector3 worldPos)
 {
     worldPos.y         = transform.position.y;
     worldPos           = BuildGrid.WorldToGridCenter(worldPos);
     transform.position = worldPos;
 }