public Dreadnaught(string id) : base(id, "Dreadnaught_front_model", 0.87f, 10000, 4, 0.01f, 100000) { //Collider _boxRadius = 24.5f; //_box = new RectangularPrism(25, 94, Position); _box = new Sphere(Position, _boxRadius, new Quaternion(0, 0, 0, 1)); //Back side _backModel = StaticModelManager.GetModel("Dreadnaught_back_model"); _backModel.setParent(_mainModel); //Rings _ringModels = new StaticModel[2]; _ringModels[0] = StaticModelManager.GetModel("Dreadnaught_ring_model"); _ringModels[0].Position = new Vector3(0, -0.60810f, 0); //this tilt is a fix _ringModels[0].setParent(_mainModel); _ringModels[1] = StaticModelManager.GetModel("Dreadnaught_ring_model"); _ringModels[1].Position = new Vector3(0, -0.60810f, -3.0701f); //this tilt is a fix _ringModels[1].setParent(_backModel); //Cannons _cannons = new SmallCannon[7]; for (int i = 0; i < _cannons.Length; i++) { _cannons[i] = new SmallCannon(id + "_SmallCannon_" + (i+1) ); _cannons[i].StaticModel.Id = id + "_SmallCannon_" + (i+1) ; _cannons[i].FireSpeed = 3; } float offset = 0.5f; //Upper Front cannons positions _cannons[0].StaticModel.PositionRelative = new Vector3(5f,2.467f+offset,40.251f); _cannons[0].StaticModel.setParent(_mainModel); _cannons[1].StaticModel.PositionRelative = new Vector3(-5f, 2.467f+offset, 40.251f); _cannons[1].StaticModel.setParent(_mainModel); _cannons[2].StaticModel.PositionRelative = new Vector3(6.793f, 3.102f+offset, 24.521f); _cannons[2].StaticModel.setParent(_mainModel); _cannons[3].StaticModel.PositionRelative = new Vector3(-6.793f, 3.102f+offset, 24.521f); _cannons[3].StaticModel.setParent(_mainModel); //Lower Front cannons positions _cannons[4].StaticModel.PositionRelative = new Vector3(0, -6.162f-offset, 24.521f); _cannons[4].StaticModel.OrientationRelative = Geometric.Generate_Quaternion(Constants.pi_float, 0, 0, 1); _cannons[4].StaticModel.setParent(_mainModel); //Lower Back cannons positions _cannons[5].StaticModel.PositionRelative = new Vector3(5.93f, -7.01f-offset, -22f); _cannons[5].StaticModel.OrientationRelative = Geometric.Generate_Quaternion(Constants.pi_float, 0, 0, 1); _cannons[5].StaticModel.setParent(_backModel); _cannons[6].StaticModel.PositionRelative = new Vector3(-5.93f, -7.01f-offset, -22f); _cannons[6].StaticModel.OrientationRelative = Geometric.Generate_Quaternion(Constants.pi_float, 0, 0, 1); _cannons[6].StaticModel.setParent(_backModel); /* _coolerLeftModels = new StaticModel[3]; _coolerRightModels = new StaticModel[3]; _ringModels = new StaticModel[2]; for (int i = 0; i < _coolerLeftModels.Length; i++) { _coolerLeftModels[i] = StaticModelManager.GetModel("Dreadnaught_cooler_model"); _coolerRightModels[i] = StaticModelManager.GetModel("Dreadnaught_cooler_model"); _coolerRightModels[i].Scale = new Vector3( - _coolerRightModels[i].Scale.X, _coolerRightModels[i].Scale.Y, _coolerRightModels[i].Scale.Z); } //TODO setup cannons and coolers relative positions _frontCannons[0].Position = new Vector3(0, 0, 0); _frontCannons[1].Position = new Vector3(0, 0, 0); _frontCannons[2].Position = new Vector3(0, 0, 0); _frontCannons[3].Position = new Vector3(0, 0, 0); _frontCannons[4].Position = new Vector3(0, 0, 0); _frontCannons[5].Position = new Vector3(0, 0, 0); _coolerLeftModels[0].Position = new Vector3(0, 0, 0); _coolerRightModels[0].Position = new Vector3(0, 0, 0); _coolerLeftModels[1].Position = new Vector3(0, 0, 0); _coolerRightModels[1].Position = new Vector3(0, 0, 0); _coolerLeftModels[2].Position = new Vector3(0, 0, 0); _coolerRightModels[2].Position = new Vector3(0, 0, 0); _ringModels[0] = StaticModelManager.GetModel("Dreadnaught_ringfront_model"); _ringModels[1] = StaticModelManager.GetModel("Dreadnaught_ringback_model"); */ }
public void addChildren(StaticModel child) { if (child != null) { //is it already there? if not... (how to check?) try { _childrenModels.Add(child); } catch(System.Exception e) { Output.WriteLine(e.Message); } _hasChildren = true; if (child.ParentModel == null || (child.ParentModel != null && StaticModel.CompareTo(child.ParentModel, this) != Comparison.Equal) ) child.setParent(this); } }