本文整理汇总了C#中Projectile.Shoot方法的典型用法代码示例。如果您正苦于以下问题:C# Projectile.Shoot方法的具体用法?C# Projectile.Shoot怎么用?C# Projectile.Shoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projectile
的用法示例。
在下文中一共展示了Projectile.Shoot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: spawnProjectile
private void spawnProjectile()
{
if (attackSound)
{
AudioSource.PlayClipAtPoint(attackSound, transform.position);
}
dir = new Vector3(targetPos.x - transform.position.x, 0, 0);
distL = (transform.position - targetPos - left).magnitude;
distR = (transform.position - targetPos - right).magnitude;
toLeft = (attackRange + distL) <= distR;
bool facing = distL <= distR;
short faceDir;
if (facing)
faceDir = -1;
else
faceDir = 1;
shot = Instantiate(shotObj, transform.position + faceDir * xhalf, transform.rotation) as Projectile;
shot.Shoot(dir.normalized);
}
示例2: boltAttack
private void boltAttack()
{
//animation
//bolt
bolt = Instantiate(boltObj, transform.position, transform.rotation) as Projectile;
bolt.setStun(bolt_Stun);
//Debug.Log(direction);
findPos();
bolt.Shoot(0, direction / 1.5f);
bolt_CD = 0;
}
示例3: ballAttack
public void ballAttack()
{
ball = Instantiate(ballObj, transform.position, transform.rotation) as Projectile;
ball.Shoot(0, direction * 0.7f);
fireBall_CD = 0;
iceBall_CD = 0;
}
示例4: Update
// Update is called once per frame
void Update()
{
foreach (GameObject enem in enemies)
{
tempDist = (transform.position - enem.transform.position).magnitude;
if (tempDist < distance)
{
distance = tempDist;
dir = (transform.position - enem.transform.position).normalized;
}
}
if (enemies.Count < 1)
{
somethingToAttack = false;
}
else
{
somethingToAttack = true;
}
if(somethingToAttack)
{
if(shot_CD >= 2)
{
shot = Instantiate(shotObj, transform.position, transform.rotation) as Projectile;
shot.Shoot(-dir);
shot_CD = 0;
}
}
shot_CD += Time.deltaTime;
}