本文整理汇总了C#中Hero.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# Hero.GetComponent方法的具体用法?C# Hero.GetComponent怎么用?C# Hero.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hero
的用法示例。
在下文中一共展示了Hero.GetComponent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
void Update()
{
if (Input.GetMouseButtonDown(0)) {
RaycastHit2D hit = Physics2D.Raycast( Camera.main.ScreenToWorldPoint (Input.mousePosition), Vector2.zero);
if (hit) {
hero = hit.collider.gameObject.GetComponent<Hero>();
if (hero.tag == "Hero") {
if (!Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.RightControl)) {
heroes.Clear();
}
heroes.Add(hero);
if (!hero.GetComponent<AudioSource>().isPlaying)
hero.GetComponent<AudioSource>().Play();
// Debug.Log("heroes.Count = " + heroes.Count);
}
} else {
foreach (Hero one in heroes) {
one.setDestination(Input.mousePosition);
}
}
} else if (Input.GetMouseButtonDown(1)) {
heroes.Clear();
}
}
示例2: OnActivate
/* BEGIN REGULAR POWER */
public override IEnumerator OnActivate(Hero sourceHero, Hero otherHero)
{
CreateBungieLink(otherHero, sourceHero, "SpiritLinkChain");
//Debug.Log("Activating" + this.GetType());
heroCC = otherHero.GetComponent<CharacterController>();
currentBungieTime = 0;
initialPosition = otherHero.transform.position;
Vector3 directionToBungie = GetBungieMovement(currentBungieTime, initialPosition, sourceHero.transform.position - initialPosition, durationToBungie);
heroCC.Move(directionToBungie - otherHero.transform.position);
return null;
}
示例3: castingSkill
public void castingSkill()
{
if(targetObj != null){
heroIceBlock = HeroMgr.getRandomHero();
if(heroIceBlock == null){
return;
}
Hero hitHero = heroIceBlock.GetComponent<Hero>();
if(tempFlame_sk_IceBlock == null && this.isDead == false && hitHero.isDead==false){
state = CAST_STATE;
playAnim("Skill");
MusicManager.playEffectMusic("boss_freezeGuy_skill");
}else{
if(tempFlame_sk_IceBlock.transform.position.x == -1000){
Destroy(tempFlame_sk_IceBlock);
state = CAST_STATE;
playAnim("Skill");
MusicManager.playEffectMusic("boss_freezeGuy_skill");
}
}
}
}
示例4: AddToHero
public static void AddToHero(Hero hero)
{
var sb = hero.GetComponent <ShieldBuff> ();
sb.enabled = true;
}
示例5: AddToHero
public static void AddToHero(Hero hero)
{
var sb = hero.GetComponent <WallBuffer> ();
sb.enabled = true;
}