本文整理汇总了C#中Pokemon.SetCaptureResult方法的典型用法代码示例。如果您正苦于以下问题:C# Pokemon.SetCaptureResult方法的具体用法?C# Pokemon.SetCaptureResult怎么用?C# Pokemon.SetCaptureResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pokemon
的用法示例。
在下文中一共展示了Pokemon.SetCaptureResult方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShakeOnce
private void ShakeOnce()
{
if (_state != PokeballState.Shaking)
{
return;
}
_shakeLeft--;
if (_shakeLeft > 0)
{
// For now Pokéballs are Masterballs.
float escapeChance = 0.045f; // We should get this value from the Pokemon stats. // 0.045 escape chance makes a capture probability between 75% to 83% after 4 to 6 shakes.
if (Random.value < escapeChance)
{
Explode();
}
else
{
Vector3 force = Random.onUnitSphere * 0.3f;
force.y = 0;
Freeze(false);
StopMove();
_rigid.AddForce(force, ForceMode.VelocityChange);
PlaySound("Shake");
float delay = Random.Range(1.3f, 2f) + (_shakeLeft == 1 ? 1.2f : 0f);
//if (_editorTest)
{
delay *= 0.75f;
}
//object[] parms = new object[2] { -force, delay / 2f };
object[] parms = new object[2] { -force, 0.25f };
StartCoroutine("BalanceShakeForce", parms);
Invoke("ShakeOnce", delay);
}
}
else
{
// The capture is a success!
_state = PokeballState.Lying;
_isPokemonInside = true;
_shakeLeft = -1;
_content = _temporaryContent;
_content.StoreInPokeball();
_content.SetCaptureResult(true);
_pkmnName.text = _content._name;
_temporaryContent = null;
StopMove();
_animator.SetBool("RedLightOn", false);
PlaySound("Caught");
Instantiate(Resources.Load("Particles/CaptureParticle"), _tr.position, Quaternion.identity);
//StartBacking();
StartCoroutine(StartBackingWithDelayCoroutine(2.25f));
}
}