public void NewMap(string name)
    {
        New_Map(name);

        ClearMap();

        GameObject start_player = GameObject.Instantiate(Resources.Load <GameObject>("Prefabs/Player_Template"));

        start_player.transform.parent = Map.transform;
        start_player.tag   = "editor_obj";
        start_player.layer = 10;
        start_player.transform.position += new UnityEngine.Vector3(0.0f, 0.5f, 0.0f);
        start_player.name = Name_Generator.Run_Unique(Map);

        AddObject(start_player);
    }
Ejemplo n.º 2
0
    private void OnMouseDown()
    {
        if (new_obj == null && Template_Object != null)
        {
            new_obj = Instantiate(Template_Object);

            new_obj.transform.parent = Map.transform;

            // Log That something has been created.
            Action_Handler.Log(new_obj, "Create");

            new_obj.tag   = "place_obj";
            new_obj.layer = PLACE_OBJECT_LAYER;
            if (Map != null)
            {
                new_obj.name = Name_Generator.Run_Unique(Map);
            }
            if (File_Handler != null)
            {
                File_Handler.AddObject(new_obj);
            }

            Rigidbody r;
            if (r = new_obj.GetComponent <Rigidbody>())
            {
                r.useGravity       = false;
                r.detectCollisions = false;
            }



            if (Tool_Controller != null)
            {
                Tool_Controller.ToggleDisabled(true);
            }
        }
    }