/// <summary> /// fire a bullet. /// </summary> /// <param name="id">bullet group id</param> /// <param name="startPosition">the start position of bullet</param> /// <param name="destinationPosition">the target position of bullet</param> /// <param name="speed">the speed of bullet</param> /// <param name="length">the length of bullet</param> /// <param name="thickness">the thickness of bullet</param> /// <param name="possibleToMissing"></param> /// <returns></returns> public bool Fire(int id, Vector3 startPosition, Vector3 destinationPosition, float speed, float length, float thickness, bool possibleToMissing) { if (activeOn == false) { return(false); } TracerBullets findBullets = null; foreach (TracerBullets bullets in tracerBullets) { if (id == bullets.Id) { findBullets = bullets; } } if (findBullets == null) { throw new InvalidOperationException("Cannot find bullets ID"); } return(findBullets.Fire(startPosition, destinationPosition, speed, length, thickness, possibleToMissing)); }
/// <summary> /// create a bullet group and create bullet instances. /// </summary> /// <param name="id">bullet group id</param> /// <param name="instanceCount">object count</param> /// <param name="textureFileName">bullet texture file</param> /// <param name="sceneParent">3D scene parent node</param> public void AddBulletInstance(int id, int instanceCount, string textureFileName, GameSceneNode sceneParent) { if (activeOn == false) return; TracerBullets defaultBullet = new TracerBullets(id, instanceCount, textureFileName, sceneParent); tracerBullets.Add( defaultBullet); }
/// <summary> /// create a bullet group and create bullet instances. /// </summary> /// <param name="id">bullet group id</param> /// <param name="instanceCount">object count</param> /// <param name="textureFileName">bullet texture file</param> /// <param name="sceneParent">3D scene parent node</param> public void AddBulletInstance(int id, int instanceCount, string textureFileName, GameSceneNode sceneParent) { if (activeOn == false) { return; } TracerBullets defaultBullet = new TracerBullets(id, instanceCount, textureFileName, sceneParent); tracerBullets.Add(defaultBullet); }