当前位置: 首页>>代码示例>>C#>>正文


C# Enumerations.ToString方法代码示例

本文整理汇总了C#中Enumerations.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Enumerations.ToString方法的具体用法?C# Enumerations.ToString怎么用?C# Enumerations.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Enumerations的用法示例。


在下文中一共展示了Enumerations.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SpawnShip

    public void SpawnShip(Enumerations.E_SHIPS Ship, int type, GameObject player = null)
    {
        GameObject ShipObject = null;
        if (type != 2)
            ShipObject = Instantiate(Resources.Load("Ships/" + Ship.ToString()) as GameObject) as GameObject;
        else
            ShipObject = player;

        // Cargar la configuracion de la nave
        ShipConfig config = ShipObject.GetComponent<ShipConfig>();

        // Crear clases
        ShipReferer referer = gameObject.AddComponent<ShipReferer>();
        referer.sim = gameObject.AddComponent<ShipSimulation>();
        referer.control = gameObject.AddComponent<ShipController>();
        referer.input = gameObject.AddComponent<ShipInput>();

        if (type != 2)
            referer.position = gameObject.AddComponent<ShipPosition>();
        else
            referer.position = ShipObject.AddComponent<ShipPosition>();

        referer.ai = gameObject.AddComponent<ShipAI>();
        referer.effects = gameObject.AddComponent<ShipTrailEffects>();
        referer.music = gameObject.AddComponent<ShipAudio>();
        referer.mesh = config.mesh;

        // Icono Minimap
        //MiniMapObject mmo = gameObject.AddComponent<MiniMapObject>();
        //Image icon = (Instantiate(Resources.Load("UI/AIMinimapIcon") as GameObject) as GameObject).GetComponent<Image>();
        //mmo.image = icon;
        //Destroy(icon);

        referer.config = config;
        referer.effects.ship = referer;
        referer.input.ship = referer;
        referer.sim.ship = referer;
        referer.position.ship = referer;
        referer.ai.ship = referer;
        referer.control.ship = referer;
        referer.music.ship = referer;

        // Crear el eje de la nave
        GameObject axis = new GameObject("Axis");
        axis.transform.localPosition = Vector3.zero;
        axis.transform.localRotation = Quaternion.identity;
        axis.transform.parent = transform;

        //
        ShipObject.transform.parent = axis.transform;
        ShipObject.transform.localPosition = Vector3.zero;
        ShipObject.transform.localRotation = Quaternion.identity;

        // Crear rigidbody
        Rigidbody body = gameObject.AddComponent<Rigidbody>();
        body.useGravity = false;
        body.constraints = RigidbodyConstraints.FreezeRotation;
        body.drag = 0f;
        body.angularDrag = 20f;
        body.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;

        // Interpolación del movimiento solo en el multiplayer
        ShipObject.GetComponent<NetworkPlayerController>().enabled = type == 2;

        // Añadimos la colision
        MeshCollider mc = referer.mesh.AddComponent<MeshCollider>();
        mc.convex = true;
        gameObject.tag = "Ship";
        mc.gameObject.tag = "Ship";
        mc.gameObject.layer = LayerMask.NameToLayer("Ship");

        PhysicMaterial physicMaterial = new PhysicMaterial();
        physicMaterial.bounciness = 0f;
        physicMaterial.dynamicFriction = 0f;
        physicMaterial.staticFriction = 0f;
        physicMaterial.frictionCombine = PhysicMaterialCombine.Minimum;
        physicMaterial.bounceCombine = PhysicMaterialCombine.Minimum;

        GameObject collider = new GameObject("Collider");
        collider.tag = "Ship";
        collider.layer = LayerMask.NameToLayer("Ship");
        collider.transform.parent = transform;
        collider.transform.localPosition = new Vector3(0, config.size.y, 0); //Vector3.zero;
        collider.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
        /*collider.AddComponent<BoxCollider>();
        collider.GetComponent<BoxCollider>().size = config.size;
        //collider.GetComponent<BoxCollider>().isTrigger = true; // CUIDADO CON ESTO
        collider.GetComponent<BoxCollider>().material = physicMaterial;
        collider.GetComponent<BoxCollider>().transform.localScale = Vector3.one;
        collider.GetComponent<BoxCollider>().gameObject.SetActive(false);*/
        mc.material = physicMaterial;

        // Esfera para representar la nave en el minimap
        GameObject minimap = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        minimap.name = "Minimap Sphere";
        minimap.layer = LayerMask.NameToLayer("Minimap");
        minimap.transform.parent = transform;
        minimap.transform.localPosition = new Vector3(0, 20, 0);
        minimap.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
        minimap.transform.localScale = new Vector3(100, 100, 100);
//.........这里部分代码省略.........
开发者ID:Arafo,项目名称:Syncopia,代码行数:101,代码来源:ShipLoader.cs

示例2: AddSkill

 public static void AddSkill(this Menu menu, Enumerations.Skills skill, string mode, bool defValue = true)
 {
     var name = string.Format("dz191.vhr.{0}.use{1}", mode.ToLower(), skill.ToString().ToLower());
     var displayName = string.Format("Use {0}", skill);
     menu.Add(name, new CheckBox(displayName, defValue));
 }
开发者ID:Xelamats,项目名称:PortAIO,代码行数:6,代码来源:MenuExtensions.cs

示例3: AddManaLimiter

 public static void AddManaLimiter(this Menu menu, Enumerations.Skills skill, string mode, int defMana = 0, bool displayMode = false)
 {
     var name = string.Format("dz191.vhr.{0}.mm.{1}.mana", mode.ToLower(), skill.ToString().ToLower());
     var displayName = displayMode ? string.Format("{0} Mana {1}", skill, mode) : string.Format("{0} Mana", skill);
     menu.Add(name, new Slider(displayName, defMana));
 }
开发者ID:Xelamats,项目名称:PortAIO,代码行数:6,代码来源:MenuExtensions.cs

示例4: OnMyShip

 public void OnMyShip(Enumerations.E_SHIPS newShip)
 {
     playerShip = newShip;
     shipDisplayButton.transform.GetChild(0).GetComponent<Text>().text = newShip.ToString();
 }
开发者ID:Arafo,项目名称:Syncopia,代码行数:5,代码来源:LobbyPlayer.cs

示例5: GetListBarHtml

 /// <summary>
 /// 得到帖子列表导航的HTML代码
 /// </summary>
 /// <param name="typeMain"></param>
 /// <param name="showType"></param>
 /// <returns></returns>
 public static string GetListBarHtml(Enumerations.BBSTypeMain typeMain, Enumerations.BBSShowType showType)
 {
     if (showType == Enumerations.BBSShowType.全部帖子)
         return "";
     else
         return typeMain.ToString() + "&nbsp;>>&nbsp;" + showType.ToString();
 }
开发者ID:dalinhuang,项目名称:myxx,代码行数:13,代码来源:bbs.cs


注:本文中的Enumerations.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。