本文整理汇总了C#中Combatant.GetAudioSource方法的典型用法代码示例。如果您正苦于以下问题:C# Combatant.GetAudioSource方法的具体用法?C# Combatant.GetAudioSource怎么用?C# Combatant.GetAudioSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Combatant
的用法示例。
在下文中一共展示了Combatant.GetAudioSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateObjects
private BattleText CreateObjects(Combatant combatant)
{
BattleText bt = null;
GameObject txtObj = new GameObject();
Transform trans = TransformHelper.GetChild(this.posChild, combatant.prefabInstance.transform);
txtObj.transform.position = trans.position;
if(DataHolder.BattleSystemData().mountTexts)
{
txtObj.transform.parent = trans;
}
if(GUISystemType.ORK.Equals(DataHolder.GameSettings().guiSystemType))
bt = txtObj.AddComponent<BattleText>();
else
bt = (BattleTextGUI)txtObj.AddComponent<BattleTextGUI>();
if(this.spawnPrefab)
{
GameObject pref = this.GetPrefab();
if(pref != null)
{
trans = TransformHelper.GetChild(this.prefabChild, combatant.prefabInstance.transform);
pref.transform.position = trans.position+trans.TransformDirection(this.prefabOffset);
pref.transform.rotation = trans.rotation;
if(DataHolder.BattleSystemData().mountTexts)
{
pref.transform.parent = trans;
}
if(this.prefabTime > 0)
{
DestroyAfterTime comp = pref.AddComponent<DestroyAfterTime>();
comp.time = this.prefabTime;
}
}
}
if(this.playAudio)
{
AudioSource s = combatant.GetAudioSource();
if(s != null)
{
s.PlayOneShot(this.GetAudioClip());
}
}
return bt;
}
示例2: Use
/*
============================================================================
Use functions
============================================================================
*/
public bool Use(Combatant user, int element, Combatant target, float damageFactor, float damageMultiplier)
{
bool hit = false;
if(target.IsBlockBaseAttacks())
{
DataHolder.BattleSystemData().blockTextSettings.ShowText("", target);
}
else if((user is Enemy || this.ConsumeItems()) &&
(!this.hitChance || DataHolder.GameSettings().GetRandom() <=
(DataHolder.Formulas().formula[this.hitFormula].Calculate(user, target) + user.GetHitBonus())))
{
hit = true;
int eID = user.GetEffectAttackElement();
if(eID < 0)
{
eID = element;
}
ValueChange[] changes = this.consume;
AudioClip clip = null;
if(this.hasCritical && DataHolder.GameSettings().GetRandom() <=
DataHolder.Formula(user.baseCritical).Calculate(user, target) + user.GetCriticalBonus())
{
changes = this.criticalConsume;
clip = this.GetCriticalAudio();
}
if(clip == null)
{
clip = this.GetAttackAudio();
}
if(clip != null && target.prefabInstance != null)
{
AudioSource s = target.GetAudioSource();
if(s != null)
{
s.PlayOneShot(clip);
}
}
for(int i=0; i<changes.Length; i++)
{
if(changes[i].active)
{
int change = changes[i].ChangeValue(i, eID, user, target, true, damageFactor, damageMultiplier);
if(this.absorb)
{
change *= this.absorbValue;
change /= 100;
user.status[i].AddValue(change, true, false, true);
}
}
}
this.stealChance.Steal(user, target);
}
else
{
DataHolder.BattleSystemData().missTextSettings.ShowText("", target);
}
return hit;
}