コード例 #1
0
        private static void Detonate(
            BehaviorUpdateContext context,
            WeaponTarget target,
            bool detonateCallsKill,
            FXList groundHitFX)
        {
            // TODO: Should this ever be null?
            if (context.GameObject.CurrentWeapon != null)
            {
                context.GameObject.CurrentWeapon.SetTarget(target);
                context.GameObject.CurrentWeapon.Fire();
            }

            if (target.TargetType == WeaponTargetType.Position)
            {
                groundHitFX?.Execute(new FXListExecutionContext(
                                         context.GameObject.Rotation,
                                         context.GameObject.Translation,
                                         context.GameContext));
            }

            if (detonateCallsKill)
            {
                context.GameObject.Kill(DeathType.Detonated);
            }
            else
            {
                context.GameObject.Die(DeathType.Detonated);
            }
        }
コード例 #2
0
        public FXListView(DiagnosticViewContext context, FXList fxList)
            : base(context)
        {
            _renderedView = AddDisposable(new RenderedView(context));

            fxList.Execute(
                new FXListExecutionContext(
                    Quaternion.Identity,
                    Vector3.Zero,
                    _renderedView.Scene.GameContext));
        }
コード例 #3
0
ファイル: FiringWeaponState.cs プロジェクト: nashmit/OpenSAGE
        protected override void OnEnterStateImpl(TimeSpan enterTime)
        {
            base.OnEnterStateImpl(enterTime);

            if (Context.Weapon.UsesClip)
            {
                Context.Weapon.CurrentRounds--;
            }

            Context.AudioSystem.PlayAudioEvent(Context.WeaponTemplate.FireSound.Value);

            foreach (var nugget in Context.Weapon.Nuggets)
            {
                nugget.Activate(enterTime);
            }

            var fireFXPosition = Context.GameObject.GetWeaponFireFXBonePosition(
                Context.Weapon.Slot,
                Context.WeaponIndex);

            if (fireFXPosition != null)
            {
                var fireFXListData = Context.WeaponTemplate.FireFX?.Value;
                if (fireFXListData != null)
                {
                    // TODO: Need to dispose this.
                    var fireFXList = new FXList(fireFXListData);

                    var worldMatrix = Context.GameObject.Transform.Matrix;
                    worldMatrix.Translation = fireFXPosition.Value;

                    fireFXList.Execute(
                        new FXListContext(
                            Context.GameObject,
                            worldMatrix,
                            Context.AssetLoadContext));
                }
            }
        }