本文整理汇总了C#中Coroutine类的典型用法代码示例。如果您正苦于以下问题:C# Coroutine类的具体用法?C# Coroutine怎么用?C# Coroutine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Coroutine类属于命名空间,在下文中一共展示了Coroutine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: WaitForSeconds
public WaitForSeconds(Coroutine coroutine, double seconds)
{
this.coroutine = coroutine;
TimeoutEvent e = new TimeoutEvent { Key = this };
token = Flow.Bind(e, OnTimeout);
TimeFlow.Default.Reserve(e, seconds);
}
开发者ID:nice1378,项目名称:x2clr,代码行数:7,代码来源:WaitForSeconds.cs
示例2: Restart
public void Restart()
{
if(Hazards.Count > 0)
{
spawn_coroutine = StartCoroutine(SpawnRandomHazard());
}
}
开发者ID:thk123,项目名称:WizardsRitual,代码行数:7,代码来源:HazardSpawner.cs
示例3: Move
void Move(Vector3 newPos, float duration, float delay)
{
if (_moveCoroutine != null)
StopCoroutine(_moveCoroutine);
_moveCoroutine = StartCoroutine(MoveRoutine(newPos, duration, delay));
}
开发者ID:Plimsky,项目名称:unity3d-helpers,代码行数:7,代码来源:Door.cs
示例4: Update
// Update is called once per frame
void Update()
{
if(Input.GetKeyUp (KeyCode.Space)){
switchAlly = !switchAlly;
}
//Raycasting
if (Input.GetMouseButtonUp (0)) {
Ray r = Camera.main.ScreenPointToRay (Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast (r, out hit, float.MaxValue)) {
//Debug.Log ("hit: " + hit.collider.name );
if(hit.collider.name == "Ground" ){
if(switchAlly == true && quantity_player_a < 3){
clone = Instantiate (ally_a, hit.point, allyTransform_a.rotation) as GameObject;
quantity_player_a++;
c = StartCoroutine (DeleteAlly(clone));
}else if(switchAlly == false && quantity_player_b < 3){
clone = Instantiate (ally_b, hit.point, allyTransform_b.rotation) as GameObject;
quantity_player_b++;
c = StartCoroutine (DeleteAlly(clone));
}
}
}
}
}
开发者ID:dropcity,项目名称:kittenrescue,代码行数:36,代码来源:Ally.cs
示例5: animateBlock
public void animateBlock(int currentBlockCount,int maxCount)
{
if (co != null)
StopCoroutine(co);
if(currentBlockCount > maxCount / 2)//more then half
{
mySR.color = new Color(1,1,1,1);//white
}
else if (currentBlockCount == 1)
{
mySR.color = new Color(1, 0, 0, 1);//red
}
//else if (currentBlockCount == 0)//block count is 0
//{
// mySR.color = new Color(mySR.color.r, mySR.color.g, mySR.color.b, 0);
//}
else
{
mySR.color = new Color(1, 1, 0, 1);//yellow
}
//mySR.color = new Color(mySR.color.r, mySR.color.g, mySR.color.b, 1);
alpha = mySR.color.a;
myanimator.enabled = true;
co = StartCoroutine(fadeOut());
}
开发者ID:wolong91,项目名称:MageDuel,代码行数:27,代码来源:blockController.cs
示例6: Close
public void Close(float time, Action onFinish)
{
if (m_Coroutine != null)
StopCoroutine(m_Coroutine);
m_Coroutine = StartCoroutine(MoveEyelidsCoroutine(0.0f, 0.0f, time, onFinish));
}
开发者ID:ChunChunMorning,项目名称:SharedVR-client,代码行数:7,代码来源:EyelidController.cs
示例7: Update
// Update is called once per frame
void Update () {
if(dialogManager.getID() >= startAtDialogNumber && dialogManager.getID() < endAtDialogNumber && !audioSource.isPlaying && !activate)
{
coroutineSound = StartCoroutine(WaitAndPlay(secondsToStart));
activate = true;
}
if(dialogManager.getID() >= endAtDialogNumber && activate)
{
StopCoroutine(coroutineSound);
}
if(dialogManager.getID() >= endAtDialogNumber && audioSource.isPlaying && !activateEnd)
{
audioSource.loop = false;
activateEnd = true;
if(trailSource != null)
{
trailSource.PlayScheduled( AudioSettings.dspTime + audioSource.clip.length - audioSource.time);
}
}
//if(dialogManager.getID() >= endAtDialogNumber && !audioSource.isPlaying && activateEnd && !activateTrail)
//{
// trailSource.Play();
// activateTrail = true;
//}
}
开发者ID:BubbleRap,项目名称:ExploreTheDarkness,代码行数:30,代码来源:Audio.cs
示例8: PanelTransition
protected IEnumerator PanelTransition(bool isShowing)
{
//Init
float timeLeft = 0f;
JEngine.Instance.uiManager.nbPanelInTransition++;
//Process
yield return new WaitForEndOfFrame();
if (isShowing)
{
while (canvasGroup.alpha < 1f)
{
timeLeft += Time.unscaledDeltaTime;
canvasGroup.alpha = transitionCurve.Evaluate(timeLeft / transitionDuration);
yield return new WaitForEndOfFrame();
}
}
else
{
while (canvasGroup.alpha > 0f)
{
timeLeft += Time.unscaledDeltaTime;
canvasGroup.alpha = transitionCurve.Evaluate(1f - (timeLeft / transitionDuration));
yield return new WaitForEndOfFrame();
}
canvasGroup.blocksRaycasts = false;
}
transitionCoroutine = null;
JEngine.Instance.uiManager.nbPanelInTransition--;
}
开发者ID:Janisse,项目名称:GameProject,代码行数:31,代码来源:JPanel.cs
示例9: Start
//--------------------------------------------------------------------------------------------
void Start ()
{
// get handle on player script
playerScript = GetComponent<Player> ();
if(playerScript.chassisQuick)
{
rechargeRate *= playerScript.cooldownBoost;
}
//get handle on energy bar
energyBar = GameObject.Find("EnergyBar").GetComponent<RectTransform>();
origin = energyBar.localPosition;
energySprites = Resources.LoadAll<Sprite>("GUI_Assets/EnergyIcons");
energyImg = GameObject.Find("EnergyImg").GetComponent<Image>();
blinkCoroutine = null;
meshList = playerScript.GetComponentsInChildren<MeshRenderer>();
currEnergy = maxEnergy;
isActive = false;
isOnCooldown = false;
isOnCooldownDelay = false;
isOnInitialActivate = false;
//get handle on audio source for secondary ready
AudioSource[] sources = GetComponents<AudioSource>();
readyAudio = sources[1];
//audio source for phase on and off
onSound = sources[2];
offSound = sources[3];
}
开发者ID:zachary-goodless,项目名称:Cull-the-Swarm,代码行数:36,代码来源:PhaseManager.cs
示例10: Start
//--------------------------------------------------------------------------------------------
void Start()
{
//get handle on energy bar
energyBar = GameObject.Find("EnergyBar").GetComponent<RectTransform>();
origin = energyBar.localPosition;
energySprites = Resources.LoadAll<Sprite>("GUI_Assets/EnergyIcons");
energyImg = GameObject.Find("EnergyImg").GetComponent<Image>();
blinkCoroutine = null;
//init prefabs
teslaPrefabPhase_1 = Resources.Load<GameObject>("PlayerBullets/TeslaPhase_1");
teslaPrefabPhase_2 = Resources.Load<GameObject>("PlayerBullets/TeslaPhase_2");
forwardPos = transform.Find ("GunF");
currEnergy = maxEnergy;
storedDamage = 0f;
isCharging = false;
isOnInitialActivate = false;
isOnCooldownDelay = false;
isOnCooldown = false;
//get handle on audio source for secondary ready
readyAudio = GetComponents<AudioSource>()[1];
}
开发者ID:zachary-goodless,项目名称:Cull-the-Swarm,代码行数:29,代码来源:TeslaManager.cs
示例11: Start
// Use this for initialization
void Start () {
spriteRenderer = GetComponent<SpriteRenderer> ();
if (start)
{
currentCoroutine = StartCoroutine (ChangeSprite ());
}
}
开发者ID:Dred95,项目名称:IslandUnityTest,代码行数:8,代码来源:AnimatedSprite.cs
示例12: OnFailure
private void OnFailure()
{
if (m_DisplayFailureCoroutine != null)
StopCoroutine(m_DisplayFailureCoroutine);
m_DisplayFailureCoroutine = StartCoroutine(DisplayFailure());
}
开发者ID:ChunChunMorning,项目名称:SharedVR-client,代码行数:7,代码来源:SettingManager.cs
示例13: JumpTo
public void JumpTo(WorldMapArea area)
{
Debug.Assert(jumpRoutine == null, "jump routine must not already be in progress");
jumpTarget = area;
jumpRoutine = StartCoroutine(JumpRoutine());
}
开发者ID:spriest487,项目名称:spacetrader-unity,代码行数:7,代码来源:Ship.Jump.cs
示例14: longPressHandle
private void longPressHandle(object sender, System.EventArgs e)
{
if (MenuMaster.musicVolume > 0 && MenuMaster.musicVolume < 100)
{
fastChanger = StartCoroutine(fastChange());
}
}
开发者ID:DRMold,项目名称:HungryHungryTetris,代码行数:7,代码来源:ButtonOptionChange.cs
示例15: Activate
public void Activate()
{
textMesh.text = changeText;
if( coRoutine != null )
StopCoroutine( "resetText" );
coRoutine = StartCoroutine( "resetText" );
}
开发者ID:navignaw,项目名称:flashlight,代码行数:7,代码来源:Message_ChangeText.cs
示例16: Update
public override void Update()
{
if (flyRoutine == null)
{
flyRoutine = TaskFollower.StartCoroutine(FlyRoutine());
}
}
开发者ID:spriest487,项目名称:spacetrader-unity,代码行数:7,代码来源:FlyToPointTask.cs
示例17: Activate
public override void Activate()
{
if (movement != null)
StopCoroutine (movement);
movement = StartCoroutine (Movement(transform.TransformPoint (openedPosition)));
SoundManager.Instance.SendMessage("PlaySFXOpenGate");
}
开发者ID:DylanRenan,项目名称:MuvucaGame01,代码行数:7,代码来源:Door.cs
示例18: OnEnable
public void OnEnable()
{
if (DrawAfterPostEffects)
{
m_DrawAtEndOfFrame = StartCoroutine("DrawAtEndOfFrame");
}
}
开发者ID:Scub3d,项目名称:Aerohacks,代码行数:7,代码来源:CoherentUIViewRenderer.cs
示例19: Open
public void Open(float time, Action onFinish)
{
if (m_Coroutine != null)
StopCoroutine(m_Coroutine);
m_Coroutine = StartCoroutine(MoveEyelidsCoroutine(m_OpenedUpperEyelidY, m_OpenedLowerEyelidY, time, onFinish));
}
开发者ID:ChunChunMorning,项目名称:SharedVR-client,代码行数:7,代码来源:EyelidController.cs
示例20: Pan
public void Pan(Vector3 direction, float panTime)
{
if (m_PanCR != null)
StopCoroutine(m_PanCR);
m_PanCR = StartCoroutine(pan_cr(direction, panTime));
}
开发者ID:Vicky-V,项目名称:BreakMEOWT,代码行数:7,代码来源:CameraEffects.cs
注:本文中的Coroutine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论