Here is an example of a type of game I would like to create that can apply to many different scenarios.
In this example lets use shopping malls and stores
I have two Scenes, overview, and mall
the overview scene allows user to place a single type of game object (shopping malls) at various locations on the overview scene
the mall scene allows user to place multiple different game objects (stores: ie best buy, Mc Donalds, EBgames etc) at various positions in the mall scene
For Example:
Place mall 1 mall 2 and mall 3 at differnt positions in the overview scene.
Click on mall 1 and go to mall scene for mall 1
Place stores at various locations in mall 1.
Click on overview to go back to overview and then click on mall 2 and do the same.
I place GameControl script in both scenes so that I can add store, mall info and retrieve store, mall info from both scenes
I have a mall class that contains name of the mall and a list of stores
the store class contains transform and position of store
from the overview script I am able to add a mall to the list
private List<STORE> store = new List<STORE>();
GameControl.control.malls.Add (new MALL (mall_label, store));
however I am not sure how to add a store to the mall from the mall scene
Also I am not sure How I can iterate through all the malls and show positions of all stores
This is the Overview script
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class OVERVIEW {
public string mall_name;
public List<STORE> store = new List<STORE>();
public OVERVIEW (string new_mall_name, List<STORE> new_store)
{
mall_name = new_mall_name;
store = new_store;
}
}
this is the Store Script
using UnityEngine;
using System.Collections;
public class STORE {
public Transform obj;
public Vector3 obj_pos;
public STORE (Transform new_object, Vector3 new_object_pos)
{
obj = new_object;
obj_pos = new_object_pos;
}
}
this is the GameControl Script
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GameControl : MonoBehaviour {
public static GameControl control;
public List<OVERVIEW> malls = new List<OVERVIEW>();
public string mall_label;
void Awake() {
if (control ==null)
{
DontDestroyOnLoad(gameObject);
control=this;
}
else if (control !=this)
{
Destroy(gameObject);
}
}
}