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


C# Mogre.ToString方法代码示例

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


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

示例1: OnRightClick

        /// <summary>
        /// Selectes the targeted group and finds out info about object where the mouse clicked.
        /// After that calls OnRightMouseClick on group and depending on the response is called 
        /// the appropriate action. 
        /// </summary>
        /// <param Name="clickedPoint">The mouse position.</param>
        /// <param Name="selectedObjects">The objects in clicked area.</param>
        public void OnRightClick(Mogre.Vector3 clickedPoint, List<Mogre.MovableObject> selectedObjects)
        {
            Mogre.MovableObject hitObject;
            bool isFriendly = true;
            bool isIMGO = true;

            if (selectedObjects.Count == 0) {
                // Nothing at clicked area.
                hitObject = null;
            } else {
                hitObject = selectedObjects[0];
                Team targetTeam;
                // The clicked object is not controllable.
                if (!hitTest.IsObjectControllable(hitObject.Name)) return;

                if (hitTest.IsObjectMovable(hitObject.Name)) {
                    // The clicked object is movable.
                    targetTeam = hitTest.GetIMGO(hitObject.Name).Team;
                } else {
                    // The clicked object is static.
                    targetTeam = hitTest.GetISGO(hitObject.Name).Team;
                    isIMGO = false;
                }

                // Checks if the object is friendly.
                isFriendly = teamMgr.AreFriendly(groupMgr.ActiveTeam, targetTeam);
            }

            // Gets the selected group answer on mouse action (clicked position).
            var answer = groupMgr.SelectInfoGroup(clickedPoint, hitObject, isFriendly, isIMGO);

            Game.IEffectPlayer.PlayEffect(groupSelectedSound); // Plays effect

            // Chooses the next action by the group reply.
            switch (answer) {
                case ActionAnswer.Move:
                    Game.PrintToGameConsole("Group from team " + groupMgr.GetActiveMovableGroup().Team.Name + " moving to " + clickedPoint.ToString());
                    moveMgr.GoToLocation(groupMgr.GetActiveMovableGroup(), clickedPoint);
                    break;
                case ActionAnswer.MoveTo:
                    moveMgr.GoToTarget(groupMgr.GetActiveMovableGroup(), hitTest.GetGameObject(hitObject.Name));
                    break;
                case ActionAnswer.Attack:
                    fightMgr.Attack(groupMgr.GetActiveMovableGroup(), hitTest.GetGameObject(hitObject.Name));
                    break;
                case ActionAnswer.Occupy:
                    fightMgr.Occupy(groupMgr.GetActiveMovableGroup(), hitTest.GetGameObject(hitObject.Name));
                    break;
            }
        }
开发者ID:vavrekmichal,项目名称:StrategyGame,代码行数:57,代码来源:GameObjectManager.cs


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