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


C# GameObject.GetName方法代码示例

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


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

示例1: SendEmote

        private void SendEmote(GameClient client, GameObject targetObject, eEmote emoteID, string emoteType)
        {
            string messageToSource = null;
            string messageToTarget = null;
            string messageToOthers = null;

            GamePlayer sourcePlayer = client.Player;

            bool targetMatters = false;
            if (targetObject != null)
            {
                messageToSource = LanguageMgr.GetTranslation(client, string.Format("HorseEmote.{0}.ToSource", emoteType), targetObject.GetName(0, false));
                messageToOthers = LanguageMgr.GetTranslation(client, string.Format("HorseEmote.{0}.ToOthers", emoteType), sourcePlayer.Name, targetObject.GetName(0, false), sourcePlayer.GetPronoun(1, false));

                if (targetObject is GamePlayer)
                    messageToTarget = LanguageMgr.GetTranslation(client, string.Format("HorseEmote.{0}.ToOthers", emoteType), sourcePlayer.Name, LanguageMgr.GetTranslation(client, "HorseEmote.You"), sourcePlayer.GetPronoun(1, false));

                if (messageToSource != "-" && messageToOthers != "-")
                    targetMatters = true;
            }

            if (!targetMatters)
            {
                targetObject = null;
                messageToSource = LanguageMgr.GetTranslation(client, string.Format("HorseEmote.{0}.NoTargetToSource", emoteType));
                messageToOthers = LanguageMgr.GetTranslation(client, string.Format("HorseEmote.{0}.NoTargetToOthers", emoteType), sourcePlayer.Name, sourcePlayer.GetPronoun(1, false));
            }

            foreach (GamePlayer player in sourcePlayer.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                player.Out.SendEmoteAnimation(sourcePlayer, emoteID);

            SendEmoteMessages(sourcePlayer, targetObject as GamePlayer, messageToSource, messageToTarget, messageToOthers);

            return;
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:35,代码来源:horse.cs

示例2: SetBindToPhysicalCamera

    public void SetBindToPhysicalCamera(GameObject camObj)
    {
        gameObjectParentedTo = camObj;
        gameObjectParentedToName = camObj.GetName();

        // load back using CameraRotationLimit's x and y angles
        SetUpdateLookAtDirAndPosition();

        // If the camObj is sticky camera, AND sticky camera is stuck on a non-static object
        isParentObjStatic = true;
        if (camObj == Common.GetStickyCamera())
        {
            CTransform wallObj = camObj.transform.GetParent();
            if (wallObj != null)
            {
                CPhysics phy = wallObj.gameObject.GetComponent<CPhysics>();
                if (phy != null && phy.mColliderType != 0)
                {
                    isParentObjStatic = false;
                }
            }
        }
        else if (camObj == Common.GetRCCarCam())
        {
            isParentObjStatic = false;
        }
    }
开发者ID:Reticulatas,项目名称:MochaEngineFinal,代码行数:27,代码来源:CameraCam.cs

示例3: GetButtonIndex

    public int GetButtonIndex(GameObject obj)
    {
        if (allButtons.Count == 0)
        {
            string objName = "";
            for (int i = 0; i < 4; ++i)
            {
                objName = Common.prefix;
                switch (i)
                {
                    case 0: objName += "TSR2_DoorUnlockPanelStealthA"; break;
                    case 1: objName += "TSR2_DoorUnlockPanelStealthB"; break;
                    case 2: objName += "TSR2_DoorUnlockPanelStealthC"; break;
                    case 3: objName += "TSR2_DoorUnlockPanelStealthD"; break;
                }
                GameObject panel = GameObject.GetGameObjectByName(objName);
                GameObject button = Common.GetChildByName(panel, "DoorUnlockButton");
                GameObject buttonTriggered = Common.GetChildByName(button, "0");
                allButtons.Add(GetScript<MiniGameFourPlayersButton>(buttonTriggered));
            }

            //allButtons.Add(GetScript<MiniGameFourPlayersButton>(GameObject.GetGameObjectByName(Common.prefix + "TSR2_DoorUnlockPanelStealthB")));
            //allButtons.Add(GetScript<MiniGameFourPlayersButton>(GameObject.GetGameObjectByName(Common.prefix + "TSR2_DoorUnlockPanelStealthC")));
            //allButtons.Add(GetScript<MiniGameFourPlayersButton>(GameObject.GetGameObjectByName(Common.prefix + "TSR2_DoorUnlockPanelStealthD")));
        }

        for (int i = 0; i < allButtons.Count; ++i)
        {
            string objName = "";
            switch (i)
            {
                case 0: objName = "TSR2_DoorUnlockPanelStealthA"; break;
                case 1: objName = "TSR2_DoorUnlockPanelStealthB"; break;
                case 2: objName = "TSR2_DoorUnlockPanelStealthC"; break;
                case 3: objName = "TSR2_DoorUnlockPanelStealthD"; break;
            }
            GameObject panelParent = obj.transform.GetParent().GetParent().gameObject;
            if (objName == panelParent.GetName())
            {
                return i;
            }
        }
        Logger.Log("Bad init of minigame 4 player button, name: " + obj.GetName());
        return 0;
    }
开发者ID:Reticulatas,项目名称:MochaEngineFinal,代码行数:45,代码来源:MiniGameFourPlayersButtonController.cs

示例4: CMD_AppendNumber

 public static void CMD_AppendNumber(GameObject obj)
 {
     IEnumerable<GameObject> objenum = null;
     if (obj.transform.GetParent() == null)
         objenum = EngineManagerViewModel.instance.CurrentGameObjects.AsEnumerable<GameObject>();
     else
     {
         Converters.CTransformListToGameObjectListConverter conv = new Converters.CTransformListToGameObjectListConverter();
         objenum = (conv.Convert(obj.transform.GetParent().children,null, null, null) as ObservableCollection<GameObject>).AsEnumerable<GameObject>();
     }
     string obj_name = obj.GetName();
     for (int i = 0; i < obj_name.Length; ++i)
     {
         if (char.IsDigit(obj_name[i]))
         {
             obj_name = obj_name.Remove(i);
             break;
         }
     }
     obj_name = obj_name.Trim();
     int index = objenum.Count(new Func<GameObject,bool>((GameObject g)=>{ return g.GetName().Contains(obj_name); }));
     obj.SetName(obj_name + " " + index.ToString());
 }
开发者ID:,项目名称:,代码行数:23,代码来源:

示例5: RemoveItem

		protected static void RemoveItem(GameObject target, GamePlayer player, InventoryItem item, bool notify)
		{
			if (item == null)
			{
				log.Error("item is null in RemoveItem:" + Environment.StackTrace);
				return;
			}
			lock (player.Inventory)
			{
				if (item != null)
				{
					player.Inventory.RemoveItem(item);
                    InventoryLogging.LogInventoryAction(player, target, eInventoryActionType.Quest, item.Template, item.Count);
					if (target != null)
					{
						player.Out.SendMessage("You give the " + item.Name + " to " + target.GetName(0, false), eChatType.CT_System, eChatLoc.CL_SystemWindow);
					}
				}
				else if (notify)
				{
					player.Out.SendMessage("You cannot remove the \"" + item.Name + "\" because you don't have it.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				}
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:24,代码来源:AbstractQuest.cs

示例6: SendEmote

		// send emote animation to all visible players and format messages
		private void SendEmote(GamePlayer sourcePlayer, GameObject targetObject, eEmote emoteID, string[] emoteMessages)
		{
			string messageToSource = null;
			string messageToTarget = null;
			string messageToOthers = null;

			if (targetObject == null)
			{
				messageToSource = emoteMessages[EMOTE_NOTARGET_TO_SOURCE];
				messageToOthers = string.Format(emoteMessages[EMOTE_NOTARGET_TO_OTHERS], sourcePlayer.Name);
			}
			else
			{
				messageToSource = string.Format(emoteMessages[EMOTE_TO_SOURCE], targetObject.GetName(0, false));
				messageToOthers = string.Format(emoteMessages[EMOTE_TO_OTHERS], sourcePlayer.Name, targetObject.GetName(0, false));

				if (targetObject is GamePlayer)
					messageToTarget = string.Format(emoteMessages[EMOTE_TO_OTHERS], sourcePlayer.Name, YOU);
			}

			foreach (GamePlayer player in sourcePlayer.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
				if (!player.IsIgnoring(sourcePlayer))
					player.Out.SendEmoteAnimation(sourcePlayer, emoteID);

			SendEmoteMessages(sourcePlayer, targetObject as GamePlayer, messageToSource, messageToTarget, messageToOthers);

			return;
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:29,代码来源:emotes.cs

示例7: GameObjTreeViewItem

        public GameObjTreeViewItem(GameObject g)
        {
            gameObject = g;
            gameObjectName = g.GetName();

            Header = new GameObjectViewItem();
            (Header as GameObjectViewItem).DataContext = g;

            Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
            {
                this.Selected += GameObjTreeViewItem_Selected;
                this.Unselected += GameObjTreeViewItem_Unselected;
            }));
            EngineManagerViewModel.instance.SelectedGameObjects.CollectionChanged += SelectedGameObjects_CollectionChanged;
        }
开发者ID:,项目名称:,代码行数:15,代码来源:

示例8: AddCameraObjectToList

    // Adds to the camInMap, camInMapArea, and camInWorld lists
    public static void AddCameraObjectToList(GameObject inCamInWorld, out GameObject retCamInMap, out GameObject retCamInMapArea)
    {
        // Ensure they are initialized
        GetCamsInMap();
        GetCamsInMapArea();
        GetCamsInWorld();

        retCamInMap = null;
        retCamInMapArea = null;

        if (inCamInWorld.GetName().StartsWith(nameForCamInWorld))
        {
            // Sort and change name based on CamInWorld (parent)'s name
            String camIndexStr1 = inCamInWorld.transform.GetParent().gameObject.GetName();
            camIndexStr1 = camIndexStr1.Substring(nameForCamInWorldParent.Length);
            int index = Convert.ToInt32(camIndexStr1);

            inCamInWorld.SetName(nameForCamInWorld + camIndexStr1);
            //String camIndexStr = inCamInWorld.GetName().Substring(nameForCamInWorld.Length);
            //int index = Convert.ToInt32(camIndexStr);

            camInWorld.Add(inCamInWorld);
            // Sort the physical CamInWorld# by name, so [0] == CamInMap1 and so on, with StickyCamInMap being the last
            camInWorld.Sort(CompareCamInWorld);

            retCamInMapArea = null;

            retCamInMap = ObjectFactory.getInstance().Instantiate("CamInMap");
            retCamInMap.SetName(nameForCamInMap + index.ToString());
            for (uint i = 0; i < retCamInMap.transform.GetNumberOfChildren(); ++i)
            {
                if (retCamInMap.transform.GetChild(i).gameObject.GetName() == nameForCamInMapArea)
                {
                    retCamInMapArea = retCamInMap.transform.GetChild(i).gameObject;
                    retCamInMapArea.SetName(nameForCamInMapArea + index.ToString());
                    camInMapArea.Add(retCamInMapArea);
                    break;
                }
            }
            retCamInMap.transform.SetParent(GetMapScreen().transform.GetParent());
            camInMap.Add(retCamInMap);
            camInMap.Sort(CompareCamInMap);

            camInMapArea.Sort(CompareCamInMapArea);
        }
        else
        {
            Logger.Log("Adding camera to list: name not normal: " + inCamInWorld.GetName());

            if (inCamInWorld.GetName() == nameForStickyCamInWorld)
            {
                stickCam = inCamInWorld;
                retCamInMap = ObjectFactory.getInstance().Instantiate("CamInMap");
                retCamInMap.SetName(nameForStickyCamInMap);
                for (uint i = 0; i < retCamInMap.transform.GetNumberOfChildren(); ++i)
                {
                    if (retCamInMap.transform.GetChild(i).gameObject.GetName() == nameForCamInMapArea)
                    {
                        retCamInMapArea = retCamInMap.transform.GetChild(i).gameObject;
                        retCamInMapArea.SetName(nameForStickyCamInMap + "Area");
                        stickCamInMapArea = retCamInMapArea;
                        break;
                    }
                }
                retCamInMap.transform.SetParent(GetMapScreen().transform.GetParent());

                stickCamInMap = retCamInMap;
            }
            else if (inCamInWorld.GetName() == nameForRCCarCamInWorld)
            {
                rcCarCam = inCamInWorld;
                retCamInMap = ObjectFactory.getInstance().Instantiate("CamInMap");
                retCamInMap.SetName(nameForRCCarCamInMap);
                for (uint i = 0; i < retCamInMap.transform.GetNumberOfChildren(); ++i)
                {
                    if (retCamInMap.transform.GetChild(i).gameObject.GetName() == nameForCamInMapArea)
                    {
                        retCamInMapArea = retCamInMap.transform.GetChild(i).gameObject;
                        retCamInMapArea.SetName(nameForRCCarCamInMap + "Area");
                        break;
                    }
                }
                retCamInMap.transform.SetParent(GetMapScreen().transform.GetParent());

                rcCarCamInMap = retCamInMap;
            }
        }
    }
开发者ID:Reticulatas,项目名称:MochaEngineFinal,代码行数:89,代码来源:Common.cs

示例9: RemoveCameraObjectFromList

    // Remove from the camInMap, camInMapArea, and camInWorld lists
    public static void RemoveCameraObjectFromList(GameObject inCamInWorld)
    {
        // Ensure they are initialized
        GetCamsInMap();
        GetCamsInMapArea();
        GetCamsInWorld();

        if (inCamInWorld.GetName().StartsWith(nameForCamInWorld))
        {
            String camIndexStr = inCamInWorld.GetName().Substring(nameForCamInWorld.Length);
            int index = Convert.ToInt32(camIndexStr);

            if (!camInWorld.Remove(inCamInWorld))
                Logger.Log("RemoveCameraObjectFromList: unable to find " + inCamInWorld.GetName());
            else
                camInWorld.Sort(CompareCamInWorld);

            String inMapName = nameForCamInMap + index.ToString();
            String inMapAreaName = nameForCamInMapArea + index.ToString();
            GameObject camInMapObj = null;
            foreach (GameObject gObj in camInMap)
            {
                if (gObj.GetName() == inMapName)
                {
                    if (!camInMap.Remove(gObj))
                        Logger.Log("RemoveCameraObjectFromList: unable to find " + inMapName);
                    else
                    {
                        camInMap.Sort(CompareCamInMap);
                        camInMapObj = gObj;
                    }
                    break;
                }
            }
            GameObject camInMapAreaObj = null;
            foreach (GameObject gObj in camInMapArea)
            {
                if (gObj.GetName() == inMapAreaName)
                {
                    if (!camInMapArea.Remove(gObj))
                        Logger.Log("RemoveCameraObjectFromList: unable to find " + inMapAreaName);
                    else
                    {
                        camInMapArea.Sort(CompareCamInMapArea);
                        camInMapAreaObj = gObj;
                    }
                    break;
                }
            }

            if (camInMapAreaObj != null)
            {
                if (CameraInMap.currEnabledCamInMap != null) // Make sure currEnabled is forgotten
                {
                    CameraInMap.currEnabledCamInMap = null;
                }
            }
            if (camInMapObj != null)
            {
                camInMapObj.Destroy();
            }
        }
        else
        {
            Logger.Log("Remove camera from list: name not normal: " + inCamInWorld.GetName() + ", so do not affect list");
        }

        //Logger.Log("Cams in map now: " + camInMap.Count.ToString());
        //Logger.Log("Cams in map world now: " + camInWorld.Count.ToString());
        //Logger.Log("Cams in map area now: " + camInMapArea.Count.ToString());
    }
开发者ID:Reticulatas,项目名称:MochaEngineFinal,代码行数:72,代码来源:Common.cs

示例10: CompareCamInWorld

 public static int CompareCamInWorld(GameObject lhs, GameObject rhs)
 {
     return CompareWordsAfterLength(lhs.GetName(), rhs.GetName(), nameForCamInWorld.Length);
 }
开发者ID:Reticulatas,项目名称:MochaEngineFinal,代码行数:4,代码来源:Common.cs


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