equip() public méthode

public equip ( BodyPartType bodyPart, int id, bool changeId = true ) : void
bodyPart BodyPartType
id int
changeId bool
Résultat void
Exemple #1
0
    /*
     * private RosePatch ImportPatch(string inputDir, Transform terrainParent, Transform objectsParent)
     * {
     *      // Patch consists of the following elements:
     *      //	- .HIM file specifying the heighmap of the terrain: 65x65 image of floats
     *      //	- .TIL file specifying the texture tileset: 16x16 tiles, containing ID's that index into .ZON.Tiles, which returns index into .ZON.Textures
     *      //  - TODO: add other fileTypes here after researching
     *
     *
     *      bool success = true;
     *
     *      Debug.Log ("Importing patch from " + inputDir + "...");
     *
     *      RosePatch patch = new RosePatch(new DirectoryInfo(inputDir));
     *
     *      success &= patch.Load();
     *      success &= patch.Import(terrainParent, objectsParent);
     *
     *
     *      if(success)
     *              Debug.Log ("Patch Import complete");
     *      else
     *              Debug.Log ("!Patch Import failed");
     *
     *      return patch;
     * }
     */

    void OnGUI()
    {
        // Need to do the following:
        // - Specify a specific map to load (path + directory browser?)
        // - Specify an output directory (path + directory browser?)
        // - Button to begin conversion
        // - add any extra settings here ...

        // ----------------Example GUI elements-----------------------
        // GUILayout.Label ("Settings", EditorStyles.boldLabel);
        // myBool = EditorGUILayout.Toggle ("Toggle", myBool);
        // myFloat = EditorGUILayout.Slider ("Slider", myFloat, -3, 3);
        // -----------------------------------------------------------

        //=================== MAP =======================

        EditorGUILayout.BeginToggleGroup("Map", true);
        m_inputDir = EditorGUILayout.TextField("Input dir: ", m_inputDir);

        /*
         * if(GUILayout.Button("Import"))
         * {
         *      STB stb = new STB(m_inputDir);
         *      // STL:
         *      //		  row		  col   row
         *      //Entries[0-62]  Rows[0-5][0-61]
         *      //LZON001  korean "Canyon City of Zant" korean korean korean
         *      //LZON002  korean "City of Junon Polis" korean korean korean
         *      //LZON003  korean "Junon Cartel" ...
         *      //...
         *
         *
         *      int x=1;
         * }
         */


        if (GUILayout.Button("Import"))
        {
            // Several options based on the given path
            // 1. 3DDATA/MAPS/						-> convert rose universe
            // 2. 3DDATA/MAPS/JUNON					-> convert rose planet
            // 3. 3DDATA/MAPS/JUNON/JPT01			-> convert rose map
            // 4. 3DDATA/MAPS/JUNON/JTP01/30_30		-> convert rose patch
            // 5. Some/invalid/path
            bool          notFound  = false;
            DirectoryInfo inDirInfo = new DirectoryInfo(m_inputDir);
            switch (inDirInfo.Name.ToLower())
            {
            case "maps":                                                        // 1.
                ImportGalaxy();
                break;

            case "junon":                                                       // 2.
            case "eldeon":
            case "lunar":
                // TODO: add any new planets here...
                ImportPlanet();
                break;

            default:
                notFound = true;
                break;
            }             // switch

            if (notFound)
            {
                switch (inDirInfo.Parent.Name.ToLower())
                {
                case "junon":                                           // 3.
                case "eldeon":
                case "lunar":
                    // TODO: add any new planets here...
                    ImportMap(inDirInfo.Name.ToLower());
                    break;

                default:
                    GameObject terrain = new GameObject();
                    terrain.name = "Terrain";

                    GameObject terrainObjects = new GameObject();
                    terrainObjects.name = "Terrain Objects";
                    //ImportPatch(m_inputDir, terrain.transform, terrainObjects.transform);			// 4. (LoadPatch will handle 5. properly)
                    break;
                } // switch
            }     // if
        }         // if

        EditorGUILayout.EndToggleGroup();
        // ======================== OBJECT ==========================
        EditorGUILayout.BeginToggleGroup("Animated Object", true);
        m_szcPath = EditorGUILayout.TextField("ZSC: ", m_szcPath);
        objID     = EditorGUILayout.IntField("ID: ", objID);
        bodyPart  = EditorGUILayout.IntField("Body Part: ", bodyPart);
        transform = EditorGUILayout.ObjectField("Transform: ", transform, typeof(Transform), true) as Transform;
        if (GUILayout.Button("Create"))
        {
            if (transform != null)
            {
                player = new RosePlayer(transform.position);                  // Note: Player reference is lost after hitting play.  Must create new after that.
            }
            else
            {
                player = new RosePlayer();
            }
        }

        if (GUILayout.Button("Create Char Select"))
        {
            CharModel model = new CharModel();
            model.rig   = RigType.CHARSELECT;
            model.state = States.HOVERING;

            if (transform != null)
            {
                model.pos = transform.position;
            }

            player = new RosePlayer(model); // Note: Player reference is lost after hitting play.  Must create new after that.
        }

        if (GUILayout.Button("Equip"))
        {
            if (player != null)
            {
                player.equip((BodyPartType)bodyPart, objID);
            }

            //RosePlayer player = new RosePlayer(GenderType.MALE, WeaponType.THSWORD);
            //ResourceManager.Instance.GenerateAnimationAsset(GenderType.MALE, WeaponType.EMPTY);
            //ResourceManager.Instance.GenerateAnimationAssets();
            //GenerateCharSelectAnimations();
        }

        if (GUILayout.Button("GenerateAnimations"))
        {
            //RosePlayer player = new RosePlayer(GenderType.MALE, WeaponType.THSWORD);
            //ResourceManager.Instance.GenerateAnimationAsset(GenderType.MALE, WeaponType.EMPTY);
            //ResourceManager.Instance.GenerateAnimationAssets();
            GenerateCharSelectAnimations();
        }

        EditorGUILayout.EndToggleGroup();
    }     // OnGui()
Exemple #2
0
 public void OnChangeEquip(BodyPartType bodyPart, int id)
 {
     rosePlayer.equip(bodyPart, id);
 }
Exemple #3
0
 public void onNextHair()
 {
     currentHairSelection = (currentHairSelection + 1) % hairSelections.Length;
     currentPlayer.equip(BodyPartType.HAIR, hairSelections[currentHairSelection]);
     GameObject.Find("HairSection").transform.FindChild("Value").GetComponent <Text>().text = (currentHairSelection + 1).ToString();
 }