public ShootCube(BulletManager bulletManager, VanillaPlayer source) { this.mSource = source; this.mBulletMgr = bulletManager; this.mTimeSinceLastBall = new Timer(); this.mCamera = this.mBulletMgr.SceneMgr.GetCamera("Camera"); this.mMaterials = new string[] { "fireball", "waterball", "magicball" }; }
public bool Update(BulletManager bulletMgr, float frameTime) { if (this.mDistTravalled >= this.Range) return false; float distance = this.Speed * frameTime; this.mDistTravalled += distance; this.mYawNode.Translate(distance * this.mForwardDir, Node.TransformSpace.TS_LOCAL); if(this.mAccurateTest) { this.mRay.Origin = this.mYawNode.Position; if ( !(bulletMgr.World.getIsland() .getBlock(MainWorld.getRelativeFromAbsolute(this.mYawNode.Position), false) is Air)) return false; RaySceneQuery raySQuery = bulletMgr.SceneMgr.CreateRayQuery(this.mRay); raySQuery.SetSortByDistance(true); foreach (RaySceneQueryResultEntry raySQREntry in raySQuery.Execute()) { if (raySQREntry.movable != null && raySQREntry.distance > 0 && raySQREntry.distance <= distance) { string[] s = raySQREntry.movable.Name.Split('_'); if (s.Length == 2 && s[0] == "CharacterEnt") { int id = int.Parse(s[1]); if (id != this.mSource.Info.Id) { bulletMgr.CharacMgr.GetCharacterById(id).Hit(this.Damage, this.mSource); return false; } } } } } return true; }