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


C# Action.Perform方法代码示例

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


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

示例1: SwitchTo

    public void SwitchTo(string gameObjectName, float timeToTravel, float travelingPrecision, Action callbackAction)
    {
        if (nextTarget != null) { return; }

        nextTarget = GameObject.Find(gameObjectName);

        if (nextTarget == null) { Debug.LogWarning("target " + gameObjectName + " Not found. Camera stay here."); return; }

        actionToPerform = callbackAction;

        if (timeToTravel <= 0)
        {
            target = nextTarget;
            nextTarget = null;

            callbackAction.Perform(target);
        }
        else
        {
            this.travelingPrecision = travelingPrecision;
            xTarget = nextTarget.transform.position.x + this.deltaPosition.x;
            yTarget = nextTarget.transform.position.y + this.deltaPosition.y;
            travelingTime = timeToTravel;
        }
    }
开发者ID:KcoQuidam,项目名称:MusicalDreams,代码行数:25,代码来源:Camera2DManager.cs

示例2: TryToPassiveChat

 public void TryToPassiveChat()
 {
     foreach (NPC npc in npcDict.Values) {
         DecrementPassiveChatTimer(npc);
         if (npc.CanPassiveChat() && npc.timeTillPassiveChatAgain <= 0 && InSight(npc.gameObject, player.gameObject)) {
             SetPassiveChatTimer(npc);
             if (Random.Range(1, CHANCE_TO_PASSIVE_CHAT) > 1) {
                 if (InPassiveChatDistance(npc.gameObject, player.gameObject)) {
                     sayHi = new ShowOneOffChatAction(npc, PassiveChatToPlayer.instance.GetTextToSay(npc));
                     sayHi.Perform();
                 } else {
                     foreach (NPC npcToCheck in npcDict.Values) {
                         if (npc != npcToCheck && InPassiveChatDistance(npc.gameObject, npcToCheck.gameObject) && RequestChat(npcToCheck)) {
                             npc.AddSchedule(new NPCConvoSchedule(npc, npcToCheck, NPCPassiveConvoDictionary.instance.GetConversation(npc)));
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:10DaysLeftToLive,项目名称:TimeWhaleEngine,代码行数:22,代码来源:NPCPassiveConvoCheck.cs


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