コード例 #1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Color color;

        ObjectSpawnerScript obj = (ObjectSpawnerScript)target;

        GUILayout.Space(20);
        if (GUILayout.Button("Create new level"))
        {
            obj.CreateHolder();
        }
        GUILayout.Space(20);

        if (obj.objects != null)
        {
            for (int i = 0; i < obj.objects.Length; i++)
            {
                GUIStyle style = GUI.skin.button;
                GUI.backgroundColor = Color.black;
                style.richText      = true;

                color = Color.HSVToRGB((float)i / obj.objects.Length, 1f, 1f);

                if (GUILayout.Button("<color=#" +
                                     ColorUtility.ToHtmlStringRGB(color) +
                                     ">" + obj.objects[i].name + "</color>", style))
                {
                    obj.SpawnObject(i);
                }
            }
        }
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        mass = Random.Range(1, 100);



        thisBody = GetComponent <Rigidbody>();
        thisBody.AddForce(new Vector3(Random.Range(-startMovement, startMovement), Random.Range(-startMovement, startMovement), Random.Range(-startMovement, startMovement)));

        spawner     = GameObject.FindGameObjectWithTag("GameController");
        spawnScript = spawner.GetComponent <ObjectSpawnerScript>();
    }
コード例 #3
0
    // Use this for initialization


    void Awake()
    {
        current = this;

        uniqueLanes  = new List <int>();
        finishedList = new List <int>();

        float upDownDistance = BobbyController.getUpdownDistance();

        lane3 = new Vector2(spawnPos2, bobby.transform.position.y);
        lane2 = new Vector2(lane3.x, lane3.y + upDownDistance);
        lane1 = new Vector2(lane3.x, lane2.y + upDownDistance);
        lane4 = new Vector2(lane3.x, lane3.y - upDownDistance);
    }
コード例 #4
0
ファイル: ObjectSpawnerEditor.cs プロジェクト: CottleC/Assets
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        ObjectSpawnerScript spawner = (ObjectSpawnerScript)target;

        if (GUILayout.Button("Room 2x2"))
        {
            args = "2x2";
            go   = spawner.BuildRoom(args);
        }
        else if (GUILayout.Button("Room 2x1"))
        {
            args = "2x1";
            go   = spawner.BuildRoom(args);
        }
        else if (GUILayout.Button("Room 1x2"))
        {
            args = "1x2";
            go   = spawner.BuildRoom(args);
        }
        else if (GUILayout.Button("Room 1x1"))
        {
            args = "1x1";
            go   = spawner.BuildRoom(args);
        }
        else if (GUILayout.Button("NPC_Officer_Player"))
        {
            args = "MyOfficer";
            go   = spawner.BuildRoom(args);
        }

        if (go != null)
        {
            Selection.activeGameObject = go;
        }
    }
コード例 #5
0
 // Use this for initialization
 void Start()
 {
     spawner     = GameObject.FindGameObjectWithTag("GameController");
     spawnScript = spawner.GetComponent <ObjectSpawnerScript>();
 }