Esempio n. 1
0
        public void Handle(GameActionType gameAction, Player player)
        {
            if (this.Delegate == null)
            {
                throw new Exception("No Delegate");
            }

            if (gameAction.Type == GameActionType.GActionType.HitCatapult)
            {
                var catapult = this.Delegate.Catapults.FirstOrDefault(item => item.CatapultId == gameAction.CatapultKnockOut.CatapultId);
                if (catapult != null)
                {
                    if (!catapult.Disabled)
                    {
                        catapult.ProcessKnockOut(gameAction.CatapultKnockOut);
                        catapult.IsGrabbed = false;
                    }
                }
            }
            else if (gameAction.Type == GameActionType.GActionType.KnockoutSync && this.Delegate.IsServer)
            {
                // Server will dispatch catapult knockout messages to all clients to make sure knockout states are in sync
                foreach (var catapult in this.Delegate.Catapults.Where(catapult => catapult.Disabled))
                {
                    var knockoutInfo = new HitCatapult(catapult.CatapultId, false, false);
                    this.Delegate.DispatchActionToAll(new GameActionType {
                        CatapultKnockOut = knockoutInfo, Type = GameActionType.GActionType.HitCatapult
                    });
                }
            }
        }
        public void Handle(GameActionType gameAction, Player player)
        {
            if (this.Delegate == null)
            {
                throw new Exception("No delegate");
            }

            if (gameAction.Type == GameActionType.GActionType.OneHitKOAnimate && this.state == State.None)
            {
                this.state = State.InitialWait;
                this.startInitialFloatTime = GameTime.Time;

                this.Delegate.RemoveTableBoxNodeFromLevel();
                this.Delegate.RemoveAllPhysicsBehaviors();

                // Kill all catapults
                this.VortexActivationDelegate?.VortexDidActivate(this);
                this.SetBlocksToNoGravity();

                this.Delegate.ServerDispatchActionToAll(new GameActionType {
                    Type = GameActionType.GActionType.OneHitKOAnimate
                });

                if (this.SfxCoordinator != null)
                {
                    this.SfxCoordinator.PlayAudioFile("vortex_04", 0.5f, false);
                }

                if (this.MusicCoordinator != null)
                {
                    this.MusicCoordinator.StopCurrentMusic(2d);
                }
            }
        }
Esempio n. 3
0
 public void Handle(GameActionType gameAction, Player player)
 {
     foreach (var interaction in this.interactions.Values)
     {
         interaction.Handle(gameAction, player);
     }
 }
Esempio n. 4
0
        public void Handle(GameActionType gameAction, Player player)
        {
            if (gameAction.Type == GameActionType.GActionType.CatapultRelease)
            {
                if (this.Delegate == null)
                {
                    throw new Exception("No Delegate");
                }

                this.HandleCatapultReleaseAction(gameAction.CatapultRelease, player, this.Delegate);
            }
        }
Esempio n. 5
0
 public void Handle(GameActionType gameAction, Player player)
 {
     // Move the lever to received position unless this player is already holding a lever
     if (gameAction.Type == GameActionType.GActionType.LeverMove)
     {
         if (this.resetSwitches.Count > gameAction.LeverMove.LeverId)
         {
             if (this.activeSwitch != this.resetSwitches[gameAction.LeverMove.LeverId])
             {
                 this.resetSwitches[gameAction.LeverMove.LeverId].Angle = gameAction.LeverMove.EulerAngleX;
             }
         }
         else
         {
             throw new Exception("resetSwitches does not match across network");
         }
     }
 }
Esempio n. 6
0
        public void Handle(GameActionType gameAction, Player player)
        {
            if (this.Delegate == null)
            {
                throw new Exception("No delegate");
            }

            switch (gameAction.Type)
            {
            // Try Grab
            case GameActionType.GActionType.TryGrab:
                this.HandleTryGrabAction(gameAction.TryGrab, player, this.Delegate);
                break;

            // Inform specific player of grab, when it succeeds
            case GameActionType.GActionType.GrabStart:
                this.HandleGrabStartAction(gameAction.GrabStart, player, this.Delegate);
                break;

            // Sling Move
            case GameActionType.GActionType.GrabMove:
                this.HandleGrabMove(gameAction.GrabMove, player, this.Delegate);
                break;

            // Try Release
            case GameActionType.GActionType.TryRelease:
                this.HandleTryReleaseAction(gameAction.TryRelease, player, this.Delegate);
                break;

            // Inform specific player of release
            case GameActionType.GActionType.ReleaseEnd:
                this.HandleReleaseEndAction(gameAction.ReleaseEnd, player, this.Delegate);
                break;

            // Update Grabbable Status
            case GameActionType.GActionType.GrabbableStatus:
                this.HandleGrabbableStatus(gameAction.GrabbableStatus);
                break;
            }
        }
 public void Handle(GameActionType gameAction, Player player)
 {
 }