コード例 #1
0
ファイル: DroneOptionsUI.cs プロジェクト: clempers/Drones
    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
ファイル: DroneOptionsUI.cs プロジェクト: clempers/Drones
    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
ファイル: DroneOptionsUI.cs プロジェクト: clempers/Drones
    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>();
    }