本文整理汇总了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;
}
}
示例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;
}
}
}
}
}
}
}