public override string[] ToStringArray() { string[] a = new string[13]; a[0] = ID.ToString(); a[1] = GameType.ToString(); a[2] = Type.ToString(); a[3] = SubType.ToString(); a[4] = Group.ToString(); a[5] = TargetGroup.ToString(); /*a[5] = Bytes[6].ToString(); * a[6] = Bytes[7].ToString(); * a[7] = Bytes[8].ToString(); * a[8] = Bytes[9].ToString(); * a[9] = Bytes[10].ToString(); * a[10] = Bytes[11].ToString();*/ a[6] = NextID.ToString(); a[7] = Value.ToString();// Bytes[14].ToString(); //a[7] = Bytes[15].ToString(); a[8] = X.ToString(); a[9] = Y.ToString(); a[10] = OffsetX.ToString(); a[11] = OffsetY.ToString(); a[12] = Offset.ToString(); return(a); }
/// <summary> /// Serializes object into a string containing all of its public variables. /// </summary> /// <returns>Serialized object as a string.</returns> public override string Serialize() { var nextID = NextID?.ToString() ?? "-"; var outPort = OutPort?.ToString() ?? "-"; var outLabel = OutLabel?.ToString() ?? "-"; return($"{ID} {Action} {outLabel} {outPort} {nextID}"); }
/// <summary> /// Converts a whole NHLFE entry to a string; used in logs. /// </summary> /// <returns>Converted NHLFE entry to a string.</returns> public override string ToString() { var nextID = NextID?.ToString() ?? "-"; var outPort = OutPort?.ToString() ?? "-"; var outLabel = OutLabel?.ToString() ?? "-"; return($"{nameof(ID)}: {ID}, {nameof(Action)}: {Action}, {nameof(OutLabel)}: {outLabel}, {nameof(OutPort)}: {outPort}, {nameof(NextID)}: {nextID}"); }
public override void Update(GameTime gameTime) { // solve building and fixing if (playerInTrigger && InRange(NextID)) { GUIManager.Instance.DrawTexture(this.interactionTexture, this.interactionTexturePos, 0.05f, 0.05f); if (InputHandler.Instance.Action()) { if (actionHelper) { // fixing current one if (InRange(CurrentID) && Parts[CurrentID].Health < Parts[CurrentID].MaxHealth) { if (Safehouse.SafehouseController.Instance.TrashStashed >= (int)Parts[CurrentID].PricePerMs) { if (!soundHelper) { CommonActionStart(); } Parts[CurrentID].BuildUp(gameTime); //Debug.Log("HideoutStash: Fixing level " + CurrentID.ToString() + ", on " + Parts[CurrentID].Health.ToString() + "/" + Parts[CurrentID].MaxHealth.ToString() + " HP"); if (Parts[CurrentID].Health >= Parts[CurrentID].MaxHealth) { Parts[CurrentID].Health = Parts[CurrentID].MaxHealth; actionHelper = false; } } else { Debug.Log(this.MyObject.Name + " HideoutStash: Haha nie stac cie"); actionHelper = false; if (soundHelper) { CommonActionEnd(); } } } // building further if build is in progress else if (Parts[NextID].State == FortificationPart.PartState.BUILDING) { // check if we built it if (Parts[NextID].Health >= Parts[NextID].MaxHealth) { Debug.Log("HideoutStash: Fortification level " + NextID.ToString() + " has been built."); Parts[NextID].Health = Parts[NextID].MaxHealth; Parts[NextID].State = FortificationPart.PartState.BUILT; ++CurrentID; if (InRange(NextID)) { Parts[NextID].State = FortificationPart.PartState.NEXT_BUILD; Parts[NextID].Visible = true; } actionHelper = false; } else { if (Safehouse.SafehouseController.Instance.TrashStashed >= (int)Parts[NextID].PricePerMs) { if (!soundHelper) { CommonActionStart(); } // update building of that part Parts[NextID].BuildUp(gameTime); } else { Debug.Log(this.MyObject.Name + " HideoutStash: Haha nie stac cie"); actionHelper = false; if (soundHelper) { CommonActionEnd(); } } } } // we dont need to fix nor no build is in progress - acquire new build else { // check if we can even build if (Safehouse.SafehouseController.Instance.TrashStashed >= Parts[NextID].Price) { Parts[NextID].State = FortificationPart.PartState.BUILDING; } else { Debug.Log(this.MyObject.Name + " HideoutStash: Haha nie stac cie"); actionHelper = false; } } } else { if (soundHelper) { CommonActionEnd(); } } } else { if (soundHelper) { CommonActionEnd(); } actionHelper = true; } } else { if (soundHelper) { CommonActionEnd(); } } ///////////////////////////////// // solve attacking and damage ////////////////////////////// // teting //if(InputManager.Instance.GetKeyboardButtonDown(Microsoft.Xna.Framework.Input.Keys.OemPlus)) //{ // CurrentHealth += 10; // Debug.Log("Fortification: New Health " + CurrentHealth.ToString()); //} //if (InputManager.Instance.GetKeyboardButtonDown(Microsoft.Xna.Framework.Input.Keys.OemMinus)) //{ // CurrentHealth -= 10; // Debug.Log("Fortification: New Health " + CurrentHealth.ToString()); //} }