コード例 #1
0
ファイル: InteractMessage.cs プロジェクト: MyEyes/Igorr
 protected override void Decode()
 {
     objectID = _incoming.ReadInt32();
     action = (InteractAction)_incoming.ReadInt32();
     info = _incoming.ReadInt32();
     sinfo = _incoming.ReadString();
 }
コード例 #2
0
        public PartyTurnActor()
        {
            MoveAction     moveAction     = new MoveAction(m_activeActions);
            RotateAction   rotateAction   = new RotateAction(m_activeActions);
            RestAction     restAction     = new RestAction();
            InteractAction interactAction = new InteractAction();
            SelectNextInteractiveObjectAction selectNextInteractiveObjectAction = new SelectNextInteractiveObjectAction();

            m_actions = new BaseAction[4][];
            for (Int32 i = 0; i < m_actions.Length; i++)
            {
                m_actions[i]     = new BaseAction[11];
                m_actions[i][0]  = moveAction;
                m_actions[i][1]  = rotateAction;
                m_actions[i][6]  = restAction;
                m_actions[i][2]  = interactAction;
                m_actions[i][10] = selectNextInteractiveObjectAction;
                m_actions[i][3]  = new MeleeAttackAction(i);
                m_actions[i][4]  = new RangedAttackAction(i);
                m_actions[i][9]  = new CastSpellAction(i);
                m_actions[i][5]  = new ConsumeItemAction(i);
                m_actions[i][8]  = new DefendAction(i);
                m_actions[i][7]  = new EquipAction(i);
            }
        }
コード例 #3
0
        private void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                MainAction?.Invoke();
            }

            if (Input.GetKeyDown(KeyCode.Escape))
            {
                Escape?.Invoke();
            }

            if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.KeypadEnter))
            {
                InteractAction?.Invoke();
            }

            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                SetActiveSlot?.Invoke(1);
            }

            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                SetActiveSlot?.Invoke(2);
            }

            if (Input.GetKeyDown(KeyCode.BackQuote))
            {
                ToggleAnimVisibility?.Invoke();
            }
        }
コード例 #4
0
 public void TurnOff()
 {
     light.enabled = false;
     InteractText  = "Turn on";
     InteractAction.RemoveListener(TurnOff);
     InteractAction.AddListener(TurnOn);
     turnOff?.Play();
     GetComponent <Renderer>().material = turnOffMat;
 }
コード例 #5
0
ファイル: PlayerBehaviour.cs プロジェクト: AG4W/Projekt42
    public void UpdateUI()
    {
        bool[]           canMoveInDirection     = new bool[4];
        InteractAction[] canInteractInDirection = new InteractAction[4];

        //update ui
        for (int i = 0; i < Directions.cardinals.Length; i++)
        {
            Tile t = base.GetTileFromDirection(Directions.cardinals[i]);

            if (t.type == TileType.Door || t.isTraversable)
            {
                canMoveInDirection[i] = true;
            }
            else
            {
                canMoveInDirection[i] = false;
            }

            //om fiende
            if (t.entity is ActorBehaviour)
            {
                canInteractInDirection[i] = new InteractAction(
                    t.entity.GetInteractHeader(),
                    delegate
                {
                    ((ActorBehaviour)t.entity).UpdateHealth(PlayerData.GetDamage());
                    base.EndTurn();
                },
                    Color.red,
                    Icon.Attack);
            }
            //om icke-levande (loot etc)
            else if (t.entity != null)
            {
                canInteractInDirection[i] = new InteractAction(
                    t.entity.GetInteractHeader(),
                    delegate
                {
                    t.entity.Interact(this);
                    base.EndTurn();
                },
                    Color.yellow,
                    Icon.Interact);
            }
            //om ingenting
            else
            {
                canInteractInDirection[i] = null;
            }
        }

        ui.UpdateMovementPad(canMoveInDirection);
        ui.UpdateInteractionPad(canInteractInDirection);
    }
コード例 #6
0
ファイル: PlayerMovement.cs プロジェクト: ZzXxZzKk/Delte-mon
 // Remove top active tile and reveal lower tile
 public void destroyQuestAndPresentChild(InteractAction ia)
 {
     if (ia.nextTile != null)
     {
         ia.nextTile.SetActive(true);
         GameManager.curSceneData.interactables[ia.nextTile.GetComponent <InteractAction>().index] = false;
     }
     if (GameManager.curSceneName != "New Game")
     {
         GameManager.curSceneData.interactables[ia.index] = true;
     }
     if (ia.actionT != actionType.itemWithoutNext)
     {
         Destroy(ia.gameObject);
     }
 }
コード例 #7
0
    public void Interact()
    {
        //tracking
        if(ActionTracker.IsTracking)
        {
            InteractAction action = new InteractAction();
            action.Record(this);
            ActionTracker.TrackAction(action);
        }

        //
        if (OnInteract != null)
            OnInteract.Invoke (this);

        Debug.Log(string.Format("interacted with {0}",this.name));
    }
コード例 #8
0
        public override void Execute()
        {
            Model.State = BattleUIState.EventPlaying;
            Model.EventsThisActionPhase.Add(Tile.EventName);

            var poiFactory      = new PointOfInterestFactory(Model.Dimensions);
            var interaction     = new InteractAction(Tile, Model.SelectedCombatant, Model.Map);
            var pointOfInterest = interaction.GetPointofInterest(poiFactory);

            Retain();
            Action panListener = null;

            panListener = new Action(() => {
                Release();
                CameraPanCompleteSignal.RemoveListener(panListener);
                ActionAnimationCompleteSignal.Dispatch(new InteractAction(Tile, Model.SelectedCombatant, Model.Map));
            });
            CameraPanCompleteSignal.AddListener(panListener);
            PanToPointOfInterestSignal.Dispatch(pointOfInterest);
        }
コード例 #9
0
        public HoldObject(uint identifier, string name, Point3D homePosition, ushort buffId, int groundResetTime, InteractAction onPickupAction, BallAction onDropAction, BallAction onResetAction, BuffQueueInfo.BuffCallbackDelegate onBuffCallback, ushort groundModelId, ushort homeModelId)
        {
            IsActive     = false;
            Identifier   = identifier;
            this.name    = name;
            HomePosition = homePosition;
            BuffId       = buffId;
            //Heading = 1024;

            GroundResetTime = groundResetTime;

            OnPickupAction = onPickupAction;
            OnDropAction   = onDropAction;
            OnResetAction  = onResetAction;
            OnBuffCallback = onBuffCallback;

            GroundModelId = groundModelId;
            HomeModelId   = homeModelId;

            CaptureDuration = 3;
        }
コード例 #10
0
 protected override Validation <string, EntityLabel> CreateService(
     Godot.Control node, ILoggerFactory loggerFactory)
 {
     return
         (from playerControl in PlayerControl
          .ToValidation("Failed to find the player control.")
          from interactAction in InteractAction.TrimToOption()
          .ToValidation("Interact action was not specified.")
          from titleLabel in Title
          .ToValidation("Failed to find the title label.")
          select new EntityLabel(
              playerControl,
              interactAction,
              titleLabel,
              Shortcut,
              ActionTitle,
              ActionPanel,
              this,
              node,
              loggerFactory));
 }
コード例 #11
0
ファイル: PlayerMovement.cs プロジェクト: ZzXxZzKk/Delte-mon
        // Check to see if action exists for A button press in that direction
        public void aButtonPress()
        {
            // Later: if action exists, change UI to proper action
            // This should include end message and sending user back to movement UI

            Vector2      start = transform.position;
            Vector2      end   = transform.position;
            RaycastHit2D ray;

            switch (playerFacing)
            {
            case Direction.North:
                end.y++;
                break;

            case Direction.East:
                end.x++;
                break;

            case Direction.South:
                end.y--;
                break;

            case Direction.West:
                end.x--;
                break;
            }
            ray = Physics2D.Linecast(start, end, LayerMask.GetMask("StopPlayer"));

            if ((ray.collider != null) && (ray.collider.tag == "Action"))
            {
                StopMoving();
                InteractAction ia = ray.collider.gameObject.GetComponent <InteractAction>();
                if ((ia.actionT == actionType.itemWithNext) || (ia.actionT == actionType.itemWithoutNext))
                {
                    if (!ia.hasBeenViewed)
                    {
                        ia.hasBeenViewed = true;

                        // Present player with messages
                        foreach (string message in ia.messages)
                        {
                            UIManager.StartMessage(message);
                        }

                        // Award player items
                        foreach (ItemClass item in ia.items)
                        {
                            GameManager.AddItem(item, item.numberOfItem);
                        }

                        // Award player coins
                        if (ia.coins > 0)
                        {
                            GameManager.coins += ia.coins;
                            UIManager.StartMessage(GameManager.playerName + " received " + ia.coins + " coins!", null,
                                                   () => SoundEffectManager.Inst.PlaySoundImmediate("coinDing"));
                        }
                        UIManager.StartMessage(null, null, () => destroyQuestAndPresentChild(ia));
                    }
                    else
                    {
                        UIManager.StartMessage("There is nothing more of interest here");
                    }
                }
                else if (ia.actionT == actionType.message)
                {
                    foreach (string message in ia.messages)
                    {
                        UIManager.StartMessage(message);
                    }
                }
                else if (ia.actionT == actionType.quest)
                {
                    ItemData questItem = null;

                    if (ia.needsItem)
                    {
                        questItem = GameManager.allItems.Find(item => item.itemName.Equals(ia.questItem.itemName));

                        // Player doesn't have item
                        if (questItem == null)
                        {
                            foreach (string message in ia.messages)
                            {
                                UIManager.StartMessage(message, null, null);
                            }
                            UIManager.StartMessage(null, null, () => ResumeMoving());
                            return;
                        }
                        // Player doesn't have enough of the item
                        else if (questItem.numberOfItem < ia.numberOfItemsNeeded)
                        {
                            foreach (string message in ia.messages)
                            {
                                UIManager.StartMessage(message, null, null);
                            }
                            UIManager.StartMessage("You need " + (ia.numberOfItemsNeeded - questItem.numberOfItem) + " more of this item!", null, () => ResumeMoving());
                            return;
                        }
                    }
                    // Check if player has enough coins to proceed
                    if (ia.coinsNeeded > 0)
                    {
                        if (GameManager.coins < ia.coinsNeeded)
                        {
                            foreach (string message in ia.messages)
                            {
                                UIManager.StartMessage(message, null, null);
                            }
                            UIManager.StartMessage("You need " + (ia.coinsNeeded - GameManager.coins) + " more coins!", null, () => ResumeMoving());
                            return;
                        }
                        // Player has enough coins
                        else
                        {
                            GameManager.coins -= ia.coinsNeeded;
                            SoundEffectManager.Inst.PlaySoundImmediate("coinDing");
                        }
                    }

                    // Remove items
                    if (ia.needsItem)
                    {
                        questItem.numberOfItem -= ia.numberOfItemsNeeded;
                        // Remove item/s from inventory
                        if (questItem.numberOfItem < 1)
                        {
                            GameManager.allItems.Remove(questItem);
                        }
                    }

                    // Print quest completion messages
                    foreach (string message in ia.questCompletionMessages)
                    {
                        UIManager.StartMessage(message);
                    }
                    // Destroy completed quest object, update player quests
                    UIManager.StartMessage(null, null, (() => destroyQuestAndPresentChild(ia)));
                }
                else if (ia.actionT == actionType.trainer)
                {
                    NPCInteraction trainer = ia.transform.parent.GetComponent <NPCInteraction>();

                    // If trainer has already been defeated, present with end battle messages
                    if (GameManager.Inst.curSceneData.trainers[trainer.index])
                    {
                        trainer.DefeatedDialogue();
                    }
                    else
                    {
                        trainer.OnTriggerEnter2D(null);
                        return;
                    }
                }
                UIManager.StartMessage(null, null, () => ResumeMoving());
            }
        }
コード例 #12
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (!Table.IsEnabled || mouseDown == null)
            {
                base.OnMouseDown(e);
                return;
            }

            copyMode_DrugDrop = false;
            copySource        = null;
            action            = InteractAction.None;
            allowDrop         = true;
            dragCoord         = Table.GetCellLocation(e.Location);
            interactWith      = Table.Cells[e.Location];
            if (interactWith != null && interactWith.Enabled)
            {
                if (interactWith is DrawnTableCell && Table.CellCopyMode == DrawnTableCopyMode.CtrlAndDrag && ModifierKeys.HasFlag(Keys.Control))
                {
                    copySource = interactWith;
                    DrawnTableCell clone = (DrawnTableCell)interactWith.Clone();
                    Table.OnCellCopied(new CellCopiedEventArgs(clone));
                    interactWith      = clone;
                    copyMode_DrugDrop = true;
                }

                action    = InteractAction.Click;
                dragCoord = interactWith.Location;
                if (Table.AllowDragDrop) // || copyMode_DrugDrop
                {
                    Table.dRedrawEx.Join();
                    Table.dRedrawEx.Pause();

                    lock (Table.table)
                    {
                        dragBackground = (Bitmap)Table.table.Clone();
                    }
                    using Graphics g = GetGraphics(dragBackground);

                    Table.DrawBackColors(g);

                    // Drawing cells
                    foreach (DrawnTableCell item in Table.Cells)
                    {
                        if (item == interactWith && !copyMode_DrugDrop)
                        {
                            continue;
                        }
                        Table.DrawCell(item, g);
                    }

                    Table.dRedrawEx.Resume();
                }
            }
            else if (Table.AllowCreateNewCells)
            {
                CellLocation?cLoc = Table.GetCellLocation(e.Location);
                if (cLoc != null && Table.Cells[(CellLocation)cLoc] == null)
                {
                    DrawnTableCell cell = new(cLoc.Value);
                    Table.Cells.Add(cell, false);
                    CellChangedEventArgs args = new(cLoc.Value);
                    Table.OnCellCreating(args);
                    if (!args.Handled)
                    {
                        action       = InteractAction.CellCreating;
                        interactWith = Table.Cells[cLoc.Value];
                        Table.Redraw();
                    }
                    else
                    {
                        Table.Cells.Remove(cLoc.Value);
                    }
                }
            }
            startDrag = e.Location;
            mouseDown = true;

            base.OnMouseDown(e);
        }
コード例 #13
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (!Table.IsEnabled || mouseDown == null)
            {
                base.OnMouseMove(e);
                return;
            }

            Point          pos       = e.Location;
            DrawnTableCell?cellUnder = Table.Cells[pos];

            if (mouseDown == false)
            {
                if (cellUnder != null && cellUnder.Enabled)
                {
                    Cursor = Cursors.Hand;
                }
                else
                {
                    Cursor = Cursors.Default;
                }
                if (toolTip.Tag != null && !IsInArea((RectangleF)toolTip.Tag, pos))
                {
                    toolTip.Tag = null;
                    toolTip.Hide(this);
                }
                else if (Table.ShowToolTip && toolTip.Tag == null && cellUnder != null)
                {
                    Task.Factory.StartNew(async() =>
                    {
                        string?tipText = cellUnder.ToString();
                        if (cellUnder is DrawnTableCellsOverlap cellUnderOverlap)
                        {
                            tipText = "";
                            foreach (DrawnTableCell cell in cellUnderOverlap.Value)
                            {
                                tipText += cell + "\r\n\r\n";
                            }
                        }
                        if (string.IsNullOrEmpty(tipText))
                        {
                            return;
                        }

                        await Compatibility.TaskDelay(500);

                        try
                        {
                            if (mouseDown == true || toolTip.Tag != null)
                            {
                                return;
                            }
                            Invoke((MethodInvoker) delegate
                            {
                                Point posNew = CursorPosition();
                                if (cellUnder != Table.Cells[posNew])
                                {
                                    return;
                                }
                                RectangleF lPos = cellUnder.Area;
                                toolTip.Tag     = lPos;
                                toolTip.Show(tipText, this, new Point((int)lPos.Left + 5, (int)lPos.Bottom + 5), int.MaxValue);
                            });
                        }
                        catch { }
                    });
                }
            }
            else
            {
                toolTip.Tag = null;
                toolTip.Hide(this);
            }

            if (mouseDown != true)
            {
                action = InteractAction.Hover;
                base.OnMouseMove(e);
                return;
            }

            if (action == InteractAction.CellCreating)
            {
                _ = interactWith ?? throw new NullReferenceException(nameof(interactWith));

                CellLocation?cLoc = Table.GetCellLocation(e.Location, false);
                if (cLoc != null && cLoc.Value.Row != interactWith.Location.Row + interactWith.Rowspan - 1)
                {
                    if (cLoc.Value.Row >= interactWith.Location.Row)
                    {
                        int newRowspan = cLoc.Value.Row - interactWith.Location.Row + 1;
                        for (int i = 1; i < newRowspan; i++)
                        {
                            DrawnTableCell?tmp = Table.Cells[interactWith.Location.Row + i, interactWith.Location.Column];
                            if (interactWith.Location.Row + i >= Table.RowCount() || (tmp != null && tmp != interactWith))
                            {
                                newRowspan = i;
                                break;
                            }
                        }
                        interactWith.Rowspan = newRowspan;
                    }
                    else
                    {
                        interactWith.Rowspan = 1;
                    }
                }
            }
            else if (interactWith != null && interactWith.Enabled)
            {
                Cursor = Cursors.Hand;

                if (interactWith is DrawnTableCellsOverlap)
                {
                    allowDrop = false;
                }
                else if (Table.AllowDragDrop)
                {
                    bool isMovedFarEnoughToStartDragDrop = Math.Pow(startDrag.X - e.X, 2) + Math.Pow(startDrag.Y - e.Y, 2) > 3;
                    if (action == InteractAction.Drag || isMovedFarEnoughToStartDragDrop)
                    {
                        action = InteractAction.Drag;
                        Table.dRedrawEx.Execute(() => RedrawCellDrag(e));
                    }
                }
            }

            base.OnMouseMove(e);
        }
コード例 #14
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (!Table.IsEnabled || mouseDown == null)
            {
                base.OnMouseDown(e);
                return;
            }

            mouseDown = null;
            Table.dRedrawEx.Join();
            if (action == InteractAction.CellCreating)
            {
                _ = interactWith ?? throw new NullReferenceException(nameof(interactWith));

                CellChangedEventArgs args = new(interactWith.Location);
                Table.OnCellCreated(args);
                if (args.Handled)
                {
                    Table.Cells.Remove(interactWith.Location);
                }
            }
            else if (interactWith != null && interactWith.Enabled)
            {
                bool sameTable = interactWith.Table == Table;
                // Whether the MouseDown cell matches the MouseUp one
                bool sameLocation = dragCoord != null && sameTable && interactWith.Location == dragCoord.Value;
                bool sameCell     = interactWith == Table.Cells[e.Location];

                // DragDrop
                if (action == InteractAction.Drag && allowDrop)
                {
                    if (dragCoord != null && !sameLocation)
                    {
                        CellLocation?oldLocation = null;
                        if (sameTable)
                        {
                            oldLocation = interactWith.Location;
                        }
                        interactWith.Location = dragCoord.Value;
                        if (!sameTable)
                        {
                            Table.Cells.Add(interactWith);
                        }

                        CellChangedEventArgs args;

                        if (copyMode_DrugDrop)
                        {
                            args = new CellPastedEventArgs(copySource, dragCoord.Value);
                            Table.OnCellPasted((CellPastedEventArgs)args);
                        }
                        else
                        {
                            args = new CellMovedEventArgs(dragCoord.Value, oldLocation);
                            Table.OnCellDragDropFinished((CellMovedEventArgs)args);
                        }

                        if (args.Handled)
                        {
                            if (sameTable && !copyMode_DrugDrop)
                            {
                                interactWith.Location = oldLocation !.Value;
                            }
                            else
                            {
                                Table.Cells.Remove(interactWith.Location);
                            }
                        }
                    }
                }

                // Click
                if (action == InteractAction.Click && sameCell)
                {
                    if (interactWith is DrawnTableCellsOverlap interactWithOverlap)
                    {
                        Table.OnCellOverlapPlaceholderClick(new CellOverlapEventArgs(e, interactWith.Location, interactWithOverlap.Value));
                    }
                    else
                    {
                        Table.OnCellWithValueClick(new CellClickEventArgs(e, interactWith.Location));
                    }
                }
            }
            Table.Redraw();
            interactWith = null;
            action       = InteractAction.None;
            dragBackground?.Dispose();
            dragBackground = null;
            mouseDown      = false;

            base.OnMouseUp(e);
        }
コード例 #15
0
ファイル: ActionsScreen.cs プロジェクト: ThePerfectGame/COM
 void Awake()
 {
     cancelInteractAction = new InteractAction(Localization.Get("UI.Common.Cancel"), OnCancel);
 }
コード例 #16
0
ファイル: GameManager.cs プロジェクト: ZzXxZzKk/Delte-mon
        // Load the scene interactable data
        public bool UpdateSceneData(string sceneName)
        {
            // Put player and UI in the scene
            GameObject testForReferenceObject = GameObject.FindGameObjectWithTag("EditorOnly");

            if (testForReferenceObject != null)
            {
                PlayerMovement.Inst.transform.SetParent(testForReferenceObject.transform.root);
            }
            else
            {
                Debug.Log("> ERROR: No Ref obj found for player!");
            }
            GameObject testForUI = GameObject.FindGameObjectWithTag("UI");

            if (testForUI != null)
            {
                UIManager.EntireUI.SetParent(testForUI.transform);
            }

            SceneInteractionData load = sceneInteractions.Find(si => si.sceneName == sceneName);

            if (load != null)
            {
                // Set current scene interaction data
                curSceneData = load;

                // Find GameObjects containing scene interactables, trainers
                GameObject interactables = GameObject.FindGameObjectWithTag("Interactables");
                GameObject trainers      = GameObject.FindGameObjectWithTag("Trainers");

                // Find objects that have been interacted with and remove them
                for (int i = 0; i < load.interactables.Length; i++)
                {
                    InteractAction ia = interactables.transform.GetChild(i).GetComponent <InteractAction>();
                    if (ia != null)
                    {
                        ia.index = i;
                        if (load.interactables[i])
                        {
                            GameObject nextTile = ia.nextTile;
                            if (nextTile != null)
                            {
                                nextTile.SetActive(true);
                                ia.gameObject.SetActive(false);
                            }
                            else
                            {
                                ia.hasBeenViewed = true;
                                if ((ia.actionT == actionType.message) || (ia.actionT == actionType.itemWithNext))
                                {
                                    ia.gameObject.SetActive(false);
                                }
                            }
                        }
                    }
                    else
                    {
                        interactables.transform.GetChild(i).gameObject.SetActive(!load.interactables[i]);
                    }
                }
                // Find trainers that have been defeated with and set their hasTriggered bool
                for (int i = 0; i < load.trainers.Length; i++)
                {
                    NPCInteraction trainer = trainers.transform.GetChild(i).GetComponent <NPCInteraction>();
                    if (trainer == null)
                    {
                        Debug.Log("NULL TRAINER!");
                    }
                    trainer.index = i;
                    if (load.trainers[i])
                    {
                        trainer.hasTriggered = true;
                    }
                }

                return(true);
            }
            else
            {
                // Some scenes do not require scene data
                // Ex. Main menu, New Game, Recovery Center and Shop
                //Debug.Log ("> ERROR: Scene data not present!");
                return(false);
            }
        }
コード例 #17
0
 public IPointOfInterest Visit(InteractAction interact)
 {
     return(new TilePointOfInterest(_dimensions, interact.Tile.Location));
 }
コード例 #18
0
 protected override void Awake()
 {
     base.Awake();
     InteractAction.AddListener(OnInteract);
 }
コード例 #19
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     InteractAction.RemoveListener(OnInteract);
 }
コード例 #20
0
 /// <summary>
 /// Create an action from a string line
 /// </summary>
 public static Action Create(string line)
 {
     Action.ActionTypes actionType = (Action.ActionTypes)int.Parse(line.Substring (0, line.IndexOf (',')));
     switch(actionType)
     {
     case Action.ActionTypes.Movement:
         MovementAction mAction = new MovementAction();
         mAction.Load(line);
         return mAction;
         break;
     case Action.ActionTypes.Look:
         LookAction lAction = new LookAction();
         lAction.Load(line);
         return lAction;
         break;
     case Action.ActionTypes.Interact:
         InteractAction iAction = new InteractAction();
         iAction.Load(line);
         return iAction;
         break;
     case Action.ActionTypes.TextInfo:
         TextInfoAction tAction = new TextInfoAction();
         tAction.Load(line);
         return tAction;
         break;
     case Action.ActionTypes.Teleport:
         TeleportAction tlAction = new TeleportAction();
         tlAction.Load(line);
         return tlAction;
         break;
     default:
         return null;
         break;
     }
 }
コード例 #21
0
        public static InteractPacket Create(uint _uid, uint _target, ushort _x, ushort _y, InteractAction _action, uint _value)
        {
            var packet = new InteractPacket();

            packet.UID       = _uid;
            packet.Target    = _target;
            packet.X         = _x;
            packet.Y         = _y;
            packet.Action    = _action;
            packet.Value     = _value;
            packet.Timestamp = (uint)Common.Clock;
            if (packet.Action == InteractAction.MagicAttack)
            {
                EncodeMagicAttack(&packet);
            }
            return(packet);
        }
コード例 #22
0
 public Bomb(uint identifier, string name, Point3D homeLoc, ushort buffId, ushort groundResetTime, InteractAction onPickupAction, BallAction onDropAction, BallAction onResetAction,
             BuffQueueInfo.BuffCallbackDelegate onBuffCallback, ushort groundModelId, ushort homeModelId) : base(identifier, name, homeLoc, buffId, groundResetTime, onPickupAction,
                                                                                                                 onDropAction, onResetAction, onBuffCallback, groundModelId, homeModelId)
 {
     ObjectType = 1;
 }
コード例 #23
0
        /// <summary>
        ///     Check keyboard input and fire events according to what was pressed.
        /// </summary>
        private void CheckInput()
        {
            if (TMBAW_Game.CurrentGameMode == GameMode.None)
            {
                return;
            }

            if (TMBAW_Game.Dialog.IsActive)
            {
                return;
            }

            if (StoryTracker.InCutscene || GameWorld.IsInCutsceneMode)
            {
                return;
            }

            if (DialogueSystem.IsShowingDialogue)
            {
                return;
            }

            if (TMBAW_Game.CurrentGameMode == GameMode.Edit)
            {
                return;
            }

            if (IsPunchPressed() && !_attackIsPressed)
            {
                PlayerScript.TimeSinceLastPunch.Reset();
            }

            if (!PlayerScript.IsDoingAction)
            {
                if (TMBAW_Game.CurrentGameMode == GameMode.Play)
                {
                    if (IsRewindPressed())
                    {
                        RewindAction?.Invoke();
                    }
                }
                if (IsMoveLeftPressed())
                {
                    LeftMove?.Invoke();
                }
                if (IsMoveRightPressed())
                {
                    RightMove?.Invoke();
                }
                if (IsMoveDownPressed())
                {
                    if (GameWorld.WorldData.IsTopDown)
                    {
                        DownMove?.Invoke();
                    }
                    else
                    {
                        DuckAction?.Invoke();
                    }
                }
                else
                {
                    DuckActionStop?.Invoke();
                }
                if (IsInteractPressed())
                {
                    if (GameWorld.WorldData.IsTopDown)
                    {
                        UpMove?.Invoke();
                    }
                    else
                    {
                        InteractAction?.Invoke();
                    }
                }

                if (!IsMoveDownPressed() && !IsInteractPressed())
                {
                    ReleaseUpAndDownAction?.Invoke();
                }

                if (IsPunchPressed())
                {
                    if (!_attackIsPressed)
                    {
                        //FireWeaponAction?.Invoke();
                        _attackIsPressed = true;
                    }
                }
                else
                {
                    _attackIsPressed = false;
                }

                if (IsWeaponFirePressed())
                {
                    FireWeaponAction?.Invoke();
                }

                if (InputSystem.WasKeyReleased(Keys.Space) && IsJumpButtonPressed())
                {
                    JumpAction?.Invoke();
                    //_jumpButtonIsPressed = true;
                }
                //else
                //{
                //    _jumpButtonIsPressed = false;
                //}
                if (IsSprintButtonPressed())
                {
                    FastRunActive?.Invoke();
                }
                else
                {
                    FastRunInactive?.Invoke();
                }
            }


            StillUpdate?.Invoke();

            if (InputSystem.IsAnyInputPressed())
            {
                NotIdle?.Invoke();
            }
        }
コード例 #24
0
 public ResourceBox(uint identifier, string name, Point3D homePosition, ushort buffId, int groundResetTime, InteractAction onPickupAction, BallAction onDropAction, BallAction onResetAction, BuffQueueInfo.BuffCallbackDelegate onBuffCallback, ushort groundModelId, ushort homeModelId)
     : base(identifier, name, homePosition, buffId, groundResetTime, onPickupAction, onDropAction, onResetAction, onBuffCallback, groundModelId, homeModelId)
 {
     HoldResetTimeSeconds = 360;
 }