// used by Factory to recycle Bullet objects. public void Reinitialize(Controller pController, Gun pOwnerGun, Int32 pColorIndex) { controller = pController; OwnerGun = pOwnerGun; colorIndex = pColorIndex; framesAlive = 0; bulletMesh.MaterialName = Constants.DamageMaterialNames[pColorIndex]; }
public static Bullet NewBullet(Controller pController, Gun pOwnerGun, Int32 pColorIndex) { if (freeBullets.Count == 0) { return new Bullet(pController, pOwnerGun, pColorIndex); } var bullet = freeBullets.Dequeue(); bullet.Reinitialize(pController, pOwnerGun, pColorIndex); return bullet; }
public Bullet(Controller pController, Gun pOwnerGun, Int32 pColorIndex) : base(pController) { var bulletname = Methods.GenerateUniqueID.ToString(); Node = World.Instance.SceneManager.RootSceneNode.CreateChildSceneNode(bulletname); Node.IsVisible = false; MeshNode = Node.CreateChildSceneNode(); MeshNode.Scale = new Vector3(0.3, 0.3, 0.3); bulletMesh = World.Instance.SceneManager.CreateEntity(bulletname, "bullet.mesh"); MeshNode.AttachObject(bulletMesh); Reinitialize(pController, pOwnerGun, pColorIndex); }
public Ship(SceneManager pSceneManager, Controller pController) : base(pController) { var name = Methods.GenerateUniqueID.ToString(); Node = pSceneManager.RootSceneNode.CreateChildSceneNode(name); MeshNode = Node.CreateChildSceneNode(); MeshNode.Orientation = new Quaternion(0.5, 0.5, -0.5, -0.5); MeshNode.AttachObject(pSceneManager.CreateEntity(name, "ship_assault_1.mesh")); UpgradeGroup = new UpgradeGroup { CannonAutoFire = { Level = 10 }, CannonMultiFire = { Level = 10 }, CannonSpeed = { Level = 7 }, CannonPower = { Level = 5 } }; cannon = new Cannon(this); UpgradeGroup.UpgradeCannon(ref cannon, UpgradeGroup); }
protected Double x, y, ox, oy; // position. #endregion Fields #region Constructors protected MovingObject(Controller pController) { controller = pController; }