public void CreateBullet(WeaponLogicController __weapon, TimeSpan __nowTime) { //VOVA //тут создается пуля, __weapon - из какой пушки выпущена //тут тебе ненадо ничего менять имхо MyGame.ScreenLogMessage("create bullet"); LogicControllers.Parameters.BulletDynamicParameters parameters = __weapon._bulletFinalParameters; Objects.GameBulletSimple bullet = new Objects.GameBulletSimple(this, __weapon._chargedBullets._levelObjectName); Vector3 moveVector; Vector3 targetpoint = MyGame.Instance._mousepoint; Vector3 startpoint = __weapon._weaponObject._inHandObject.transform.Translation; moveVector = targetpoint - startpoint; moveVector.Normalize(); targetpoint = startpoint + moveVector * 5.0f; targetpoint = CreateRandomizedPoint(targetpoint, __weapon._baseParameters._accuracy); moveVector = targetpoint - startpoint; moveVector.Normalize(); // Matrix transform = __weapon._weaponObject._inHandObject.transform * Matrix.CreateTranslation(moveVector); Matrix transform = Matrix.CreateTranslation(0, -0.5f, 0.08f) * __weapon._weaponObject._inHandObject.transform; BulletLogicController result = new BulletLogicController( this, bullet, __nowTime, __weapon._chargedBullets, parameters, transform, moveVector); result.LocateToLevel(); }
public bool SearchBulletIntersection(BulletLogicController __bullet, Vector3 __moveVector, out Vector3 __resultPoint, out Vector3 __resultNormal, out PivotObjectMaterialType __resulttype) { Vector3 startPosition = __bullet._hisObject._object.behaviourmodel.CurrentPosition.Translation; Vector3 endPosition = startPosition + __moveVector; Vector3 intersectionPoint = new Vector3(); Vector3 intersectionNormal = new Vector3(); PivotObject intersectedObject = _scene.SearchBulletIntersection(startPosition, endPosition, out intersectionPoint, out intersectionNormal); if (intersectedObject != null) { intersectedObject.behaviourmodel.MakeJolt(intersectionPoint, __moveVector, __bullet._baseParameters._bulletMass); BaseLogicController blc = intersectedObject._gameObject as BaseLogicController; if (blc != null) blc.TakeHit(__bullet._instanceParameters); __resulttype = intersectedObject.matrialType; __resultPoint = intersectionPoint; __resultNormal = intersectionNormal; return true; } __resultPoint = new Vector3(); __resulttype = PivotObjectMaterialType.Metal; __resultNormal = new Vector3(); return false; }