コード例 #1
0
ファイル: GameLevel.cs プロジェクト: KatekovAnton/Game
        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();
        }
コード例 #2
0
        public void SetGun(WeaponLogicController __newWeapon)
        {
            if (_hisWeapon != null)
            {
                switch (_hisWeapon._weaponObject._state)
                {
                    case GameWeaponState.InHand:
                    case GameWeaponState.OnFloor:
                        {
                            _hisWeapon.SetState(GameWeaponState.None);
                        } break;
                    default: break;
                }

                _hisWeapon = null;
            }

            __newWeapon.SetState(GameWeaponState.None);

            _hisWeapon = __newWeapon;
            AnimationInfo ai = GetAnimInfo();
            _hisObject._controllerAlive.MakeUnconditionalTransition(ai._stayTopAnim, 1, false, ai._stayTopAnim);
            SwitchGun();
        }