本文整理汇总了C#中Resource.FlashingOff方法的典型用法代码示例。如果您正苦于以下问题:C# Resource.FlashingOff方法的具体用法?C# Resource.FlashingOff怎么用?C# Resource.FlashingOff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resource
的用法示例。
在下文中一共展示了Resource.FlashingOff方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Collect
public IEnumerator Collect(Resource target, int fuel, int metal)
{
yield return AimAtPosition(target.transform.WorldCenterOfElement());
var elapsedTime = Mathf.Max((fuel * Settings.Replay.FuelMultiplier + metal * Settings.Replay.MetalMultiplier) / Settings.Replay.CollectRate, 0.1f);
target.StartCoroutine(target.Beam(this, elapsedTime, BeamType.Collect));
yield return new WaitForSeconds((transform.TransformPoint(Center()) - target.transform.WorldCenterOfElement()).magnitude / Settings.Replay.BeamSpeed);
target.FlashingOn();
var score = (fuel + metal) >= Constants.Score.ValidCollectionThreshold ? Constants.Score.PerValidCollection : 0;
var effectedFuel = 0;
var effectedMetal = 0;
var effectedScore = 0;
for (float t, startTime = Time.time; (t = (Time.time - startTime) / elapsedTime) < 1;)
{
if (!Data.GamePaused)
{
var deltaFuel = Mathf.RoundToInt(fuel * t - effectedFuel);
if (deltaFuel > 0)
{
targetFuel += deltaFuel;
target.targetFuel -= deltaFuel;
effectedFuel += deltaFuel;
}
var deltaMetal = Mathf.RoundToInt(metal * t - effectedMetal);
if (deltaMetal > 0)
{
targetMetal += deltaMetal;
target.targetMetal -= deltaMetal;
effectedMetal += deltaMetal;
}
var deltaScore = Mathf.RoundToInt(score * t - effectedScore);
if (deltaScore > 0)
{
Data.Replay.TargetScores[team] += deltaScore;
effectedScore += deltaScore;
}
}
yield return null;
}
targetFuel += fuel - effectedFuel;
target.targetFuel -= fuel - effectedFuel;
targetMetal += metal - effectedMetal;
target.targetMetal -= metal - effectedMetal;
target.FlashingOff();
Data.Replay.TargetScores[team] += score - effectedScore;
string message;
if (metal == 0)
message = fuel > 0 ? "F: +" + fuel : "0";
else
message = (fuel > 0 ? "F: +" + fuel + " " : "") + "M: +" + metal;
yield return StartCoroutine(Data.Replay.Instance.ShowMessageAt(this, message));
--Data.Replay.CollectsLeft;
}