本文整理汇总了C#中Projectile.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# Projectile.GetComponent方法的具体用法?C# Projectile.GetComponent怎么用?C# Projectile.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projectile
的用法示例。
在下文中一共展示了Projectile.GetComponent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Shoot
public void Shoot()
{
Vector3 offset;
laser = Instantiate(laserObject, transform.position, transform.rotation) as Projectile;
laser.GetComponent<Rigidbody2D>().velocity = (direction * projectileSpeed);
laserCD = 0;
}
示例2: StateChanged
protected override void StateChanged() {
switch((EntityState)prevState) {
case EntityState.Normal:
CancelInvoke(activeFunc);
//CancelInvoke(fireStartFunc);
mFiring = false;
Blink(0);
if(projInactiveInvul) stats.isInvul = false;
bodySpriteCtrl.StopOverrideClip();
break;
}
base.StateChanged();
switch((EntityState)state) {
case EntityState.Normal:
CancelInvoke(activeFunc);
//CancelInvoke(fireStartFunc);
mFiring = false;
if(!mRock) {
Vector3 rockPos = transform.position;
rockPos.y += rockYOfs;
mRock = Projectile.Create(projGroup, rockProjType, rockPos, Vector3.zero, null);
mRockCtrl = mRock.GetComponent<PlatformerController>();
mRockBlinkDelay = mRock.GetComponent<EntityBlinkDelay>();
bodySpriteCtrl.controller = mRockCtrl;
if(rollerDieDelayOverride) {
mRock.dieBlink = false;
mRock.dieDelay = 0.0f;
}
}
mRockCtrl.dirHolder = transform;
mRockCtrl.moveSideLock = true;
mRockCtrl.moveSide = defaultMoveSide;
if(mRockBlinkDelay)
mRockBlinkDelay.enabled = false;
if(mSensor) {
mSensor.Activate(true);
}
if(!string.IsNullOrEmpty(projType)) {
if(mPlayers == null)
mPlayers = GameObject.FindGameObjectsWithTag("Player");
InvokeRepeating(activeFunc, 0, projActiveCheckDelay);
if(projInactiveInvul) stats.isInvul = true;
if(!string.IsNullOrEmpty(projInactiveClip))
bodySpriteCtrl.PlayOverrideClip(projInactiveClip);
}
//Invoke(fireStartFunc, projStartDelay);
break;
case EntityState.Stun:
mRockCtrl.moveSide = 0.0f;
break;
case EntityState.Dead:
if(mRock && mRock.isAlive) {
if(rollerDieDelayOverride) {
if(mRockBlinkDelay) {
mRockBlinkDelay.delay = rollerDieDelay - rollerDieBlinkDelay;
mRockBlinkDelay.enabled = true;
}
else {
mRock.dieBlink = true;
}
mRock.dieDelay = rollerDieDelay;
}
if(mRock.stats)
mRock.stats.curHP = 0;
else
mRock.state = (int)Projectile.State.Dying;
mRock = null;
}
if(mSensor) {
mSensor.Activate(false);
}
bodySpriteCtrl.controller = null;
break;
case EntityState.RespawnWait:
if(mRock && !mRock.isReleased) {
mRock.Release();
mRock = null;
mRockCtrl = null;
mRockBlinkDelay = null;
//.........这里部分代码省略.........