public override void Attack() { base.Attack(); GameObject proj1 = ProjectileManager.CreateProjectile(bulletPrefab); RayCastProj rc1 = proj1.GetComponent <RayCastProj>(); if (mount.isHead) { Vector3 dir = -mount.prevSegDir; proj1.transform.position = mount.transform.position + (0.5f * dir); rc1.startPos = proj1.transform.position; rc1.direction = dir; rc1.Cast(); } else { GameObject proj2 = ProjectileManager.CreateProjectile(bulletPrefab); RayCastProj rc2 = proj2.GetComponent <RayCastProj>(); Vector3 dir1; Vector3 dir2; if (mount.isBent) { if (doDiagonal) { dir1 = mount.nextSegDir + mount.prevSegDir; dir2 = -dir1; } else { dir1 = -mount.nextSegDir; dir2 = -mount.prevSegDir; } } else { dir1 = Vector3.Cross(Vector3.forward, mount.nextSegDir); dir2 = Vector3.Cross(Vector3.back, mount.nextSegDir); } proj1.transform.position = mount.transform.position + (0.5f * dir1); proj2.transform.position = mount.transform.position + (0.5f * dir2); rc1.startPos = proj1.transform.position; rc2.startPos = proj2.transform.position; rc1.direction = dir1; rc2.direction = dir2; rc1.Cast(); rc2.Cast(); } }
protected override void Shoot() { Vector3 dir = DirectionUtil.Convert(direction); GameObject go = ProjectileManager.CreateProjectile(projectile); RayCastProj rc = go.GetComponent <RayCastProj>(); go.transform.position = bulletSpawn.position; // + dir rc.startPos = bulletSpawn.position; rc.direction = dir; rc.Cast(); }
private void Prefire() { Vector3 dir = DirectionUtil.Convert(direction); GameObject go = ProjectileManager.CreateProjectile(prefireLaser); RayCastProj rc = go.GetComponent <RayCastProj>(); go.transform.position = bulletSpawn.position; // + dir rc.startPos = bulletSpawn.position; rc.direction = dir; rc.IgnoreCollision(GetComponent <Collider2D>()); rc.Cast(); }