示例#1
0
    private GameObject MakeDrone(MetaDroneData metaData)
    {
        GameObject drone = Instantiate(newDrone);

        drone.transform.SetParent(target);
        drone.GetComponent <DroneUI>().SetState();
        drone.transform.localScale = new Vector3(1f, 1f, 1f);
        drone.GetComponent <DroneUI>().metaDroneData = metaData;
        return(drone);
    }
示例#2
0
    private void RebuildDrone(Drone drone)
    {
        MetaDroneData metaData = allowedDrones.Find(x => drone.GetType() == x.droneType);

        if (metaData == null)
        {
            return;
        }
        GameObject newDrone = MakeDrone(metaData);

        newDrone.GetComponent <DroneUI>().realDrone = drone;
        Instantiate(metaData.creator(uiElements)).transform.SetParent(newDrone.transform);
    }
示例#3
0
    private void MakeNewDrone()
    {
        string drone_name = drone_selector.options[drone_selector.value].text;

        MetaDroneData metaData = allowedDrones.Find(x => x.name.Equals(drone_name));

        GameObject droneUI = MakeDrone(metaData);

        GameObject droneCreator = Instantiate(metaData.creator(uiElements));

        droneCreator.transform.SetParent(droneUI.transform);
        GameObject newDrone = Instantiate(droneCreator.GetComponent <ComponentCreator>().objectTemplate);

        newDrone.transform.parent = droneTemplates;
        droneUI.GetComponent <DroneUI>().realDrone = newDrone.GetComponent <Drone>();
    }