/// <summary> /// /// </summary> /// <param name="bulletSpeed"></param> /// <param name="pos"></param> /// <param name="direction"></param> /// <param name="damages"></param> /// <param name="index"></param> /// <param name="inSequence"></param> /// <param name="target"></param> /// <returns></returns> public JCS_Bullet Shoot(float bulletSpeed, Vector3 pos, bool direction, int[] damages, int index = 0, bool inSequence = false, Transform target = null) { if (mPlayer != null) { if (mPlayer.CharacterState != JCS_2DCharacterState.NORMAL) { return(null); } } int hit = damages.Length; Vector3 spawnPos = pos + mSpanwPointOffset; spawnPos = RandTransform(spawnPos); JCS_Bullet bullet = (JCS_Bullet)JCS_Utility.SpawnGameObject(mBullet, spawnPos, mSpawnPoint.rotation); // no object spawns if (bullet == null) { return(null); } // set the attacker. SetAttackerInfo(bullet); float tempBulletSpeed = bulletSpeed; // default: facing left if (!direction) { tempBulletSpeed = -tempBulletSpeed; } // set bullet speed bullet.MoveSpeed = tempBulletSpeed; // Do devication Effect DeviationEffect(bullet.transform); if (bullet is JCS_2DBullet) { bullet.GetComponent <JCS_3DGoStraightAction>().MoveSpeed = bulletSpeed; } if (mTrackSoot && target != null) { JCS_2DTrackAction ta = bullet.GetComponent <JCS_2DTrackAction>(); if (ta != null) { ta.SetTargetTransform(target); // set to center float newIndex = index - (hit / 2.0f); // apply effect ta.Index = newIndex; } } if (mAbilityFormat != null) { JCS_ApplyDamageTextToLiveObjectAction adta = bullet.GetComponent <JCS_ApplyDamageTextToLiveObjectAction>(); if (adta != null) { // set the Ability Format adta.AbilityFormat = mAbilityFormat; adta.Hit = hit; adta.DamageApplying = damages; // if hit equal to 0, // meaning this bullet is in the sequence if (inSequence) { adta.InSequence = true; } adta.TargetTransform = target; } } // part of the SFX mRandomMultiSoundAction.PlayRandomSound(); return(bullet); }