Jump to content
Aveyond Studios Community


Senior Members
  • Content Count

  • Joined

  • Last visited

  • Days Won


About rujash

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. You can also take a look at this asset: https://assetstore.unity.com/packages/tools/utilities/script-builder-type-safe-access-scripts-75162 I've seen others around. If you see any, post it.
  2. The closest I've got to this is: Create a Google Forms asking for "ActionName" "Summary" "NumberOfFields" "FieldType" "FieldTypeFunction" "FieldName" "FieldQuestion", record the answers to a sheet file. Download sheet file. Open MS Word and select as MailMerge sheet file source. Paste the HeroKit Action template in the MS Word document and place the MailMerge fields appropriately. MailMerge Finish > Edit individual documents. Save. Mass convert files to .cs. That's Fields done, but I couldn't wrap my head around implementing multiple fields easily in this method. Doing the actual action file would basically have me coding in Google Forms, which made this not worth it. So I've given up on it.
  3. I've been looking for a ton of solutions that would just perform all the steps suggested for creating a custom hero action, automatically. A simple text/document generator that takes your HeroKit action template and asks for fields, their type, and then populates the action by the submitted information. The closest I have seen to this have all been paid services like hotdocs, or limited ones that save to google drive using forms (which presents the extra work of navigating and editing in google drive, which is slooow; and requiring a rename of it). Any suggestions for this? Because I'm looking at adding a lot of actions.
  4. First create a new scene. Save scene as 'Menu'. Background Image In toolbar, go to GameObject > UI > Image. Select your newly created image object in your hierarchy. In the Rect Transform component, select horizontally and vertically stretched. Set "Top”, “Bottom”, “Left” and “Right" to zero. Now you have a fullscreen background. If you want to keep your image's resolution instead of stretching, you can mess around with the Rect Transform component values. Other Images You can import other images and then adjust the Rect Transform to place them where ever you want. Suggested: Make new images anchored to middle & center, and enable 'Preserve ratio' The further down an image or UI object is in the hierarchy, the more priority it has over the others (it will cover them). When testing in your game view tab, have your game resolution set to 1024x768 to account for the most-UI-breaking resolution and adjust there until it fits how you want. You can find it here as 'Standalone': Buttons Now you will add all your buttons. Buttons work the same as images, anchoring and being transformed by Rect Transform. Change text of the buttons, or the sprites (if you have your own button image). For this tutorial, we have two buttons: Start (New Game) and Exit (Quit Game) One Other Step One other step before getting into HeroKit, go to the EventSystem object in your Hierarchy view and then drag the Start button (under your Canvas) to the field "First Selected" in EventSystem's "Event System" component. The Setup Now that all the visual elements are set up, it's time for actually making them do something. First search in your project tab/view for "HeroKit Start Menu Controller." Duplicate it and rename to what you want. Now attach the renamed version of the Hero Object to your Canvas. Now press Edit Hero Object from the Canvas's Hero Kit Object component. In the Hero Object editor, delete all events but New Game and Quit Game. New Game: Called by an action - Load Scene: [Set to scene you wish it to load] Quit Game: Called by an action - Exit Game: Exit Game (HeroKitAction) HeroKitListenerUI2D Now we need to setup HeroKitListenerUI (this may eventually be deprecated). Go here for the tutorial, complete all the steps but the last one (see below): https://aveyond.com/forums/index.php?/topic/19332-herokit-listener-ui-onsubmit/&tab=comments#comment-468130 Now that you have duplicated and modified the HeroKitListener code files and have the ability to use HeroKitListenerUI2D, the buttons can now be set up. Go to your Start Button on your Canvas in Hierarchy view and select it to add a new component. Add HeroKitListenerUI2D to your Start Button Now do Input Type: On Submit Then drag your Canvas object from Hierarchy view to the 'Send Notifications Here' field. Select 'Send Values and Play Event' under Action Type. Under State select 'Start Game'. Under Event To Execute select 'New Game'. Now go to your Quit Button in your Hierarchy view and select it and do the same thing, except this time under Event To Execute, select 'Quit Game'. That's It Now click Play and you have a scene with a menu you can navigate with WASD/Arrow Keys and press Enter on to start or quit your game. (Made with help of article: https://pixelnest.io/tutorials/2d-game-unity/menus/ )
  5. rujash


    https://gamejolt.com/games/tom/357961 A game. 2D: Use WASD/Arrow Keys and Enter/Space to navigate menu. STATUS: Alpha - Short, unpolished art, no sound.
  6. I implemented myself. Duplicate UI Listener folder - rename to UI Listener 2D. Rename scripts to have '2D' at end of name. Replace HeroKitListenerInspector2D code with: // -------------------------------------------------------------- // Copyright (c) 2016-2017 Aveyond Studios. // All Rights Reserved. // -------------------------------------------------------------- using UnityEditor; using HeroKit.Editor.HeroField; /// <summary> /// This is the inspector for the HeroKitListener script. /// This inspector is shown when you click on a game object /// in the scene that contains the HeroKitListener script. /// </summary> [CustomEditor(typeof(HeroKitListenerUI2D))] public class HeroKitListenerUI2DInspector : Editor { /// <summary> /// The hero kit listener that will use the inspector. /// </summary> private HeroKitListenerUI2D heroKitListener; /// <summary> /// Actions to perform when the hero kit listener is enabled. /// </summary> private void OnEnable() { heroKitListener = (HeroKitListenerUI2D)target; } /// <summary> /// Display a custom inspector for the hero kit listener. /// </summary> public override void OnInspectorGUI() { // show existing inspector base.OnInspectorGUI(); if (heroKitListener != null && heroKitListener.sendNotificationsHere != null && heroKitListener.sendNotificationsHere.heroObject != null) { ChooseAction(); } } /// <summary> /// What should happen when a game object with a hero kit listener receives input (mouse click, key press, etc) /// </summary> public void ChooseAction() { string[] items = { "Send Values and Play Event", "Send Values"}; GenericListField genericList = new GenericListField(items); heroKitListener.actionType = genericList.SetValuesInspector(heroKitListener.actionType, "Action Type"); // play event if (heroKitListener.actionType <= 1) { PlayEvent(); } } /// <summary> /// Play an event on a hero kit object. /// </summary> public void PlayEvent() { // show states and events if (heroKitListener.sendNotificationsHere.heroObject.states != null && heroKitListener.sendNotificationsHere.heroObject.states.states != null && heroKitListener.sendNotificationsHere.heroObject.states.states.Count != 0) { StateListField states = new StateListField(); heroKitListener.stateID = states.SetValuesInspector(heroKitListener.stateID, heroKitListener.sendNotificationsHere.heroObject.states.states, "State"); if (heroKitListener.stateID > 0) { EventListField events = new EventListField(); heroKitListener.eventID = events.SetValuesInspector(heroKitListener.eventID, heroKitListener.sendNotificationsHere.heroObject.states.states[heroKitListener.stateID - 1].heroEvent, "Event To Execute"); } } else { if (heroKitListener != null) { heroKitListener.stateID = -1; heroKitListener.eventID = -1; } } } } Replace HeroKitListenerUI2D code with: // -------------------------------------------------------------- // Copyright (c) 2016-2017 Aveyond Studios. // All Rights Reserved. // -------------------------------------------------------------- using UnityEngine; using UnityEngine.EventSystems; using HeroKit.Scene; /// <summary> /// Script that you can attach to any game object. You can use this script to communicate with a hero kit object in the game. /// </summary> public class HeroKitListenerUI2D : MonoBehaviour, ISubmitHandler, IPointerClickHandler, IPointerDownHandler, IPointerUpHandler, IDragHandler { //------------------------------------------- // Variables //------------------------------------------- /// <summary> /// The type of input that triggers an interaction with a hero kit object. /// </summary> public enum InputType { onSubmit, onClick, onPress, onDrag, onDoubleClick }; /// <summary> /// The input type to watch for. /// </summary> public InputType inputType; /// <summary> /// The ID assigned to the hero kit listener. /// </summary> public int itemID; /// <summary> /// A hero object assigned to the hero kit listener. /// </summary> public HeroObject item; /// <summary> /// Hero kit object that should receive hero kit objects. /// </summary> public HeroKitObject sendNotificationsHere = null; /// <summary> /// Type of action to perform. /// </summary> [HideInInspector] public int actionType; /// <summary> /// ID assigned to the state on the hero kit object to interact with. /// </summary> [HideInInspector] public int stateID = -1; /// <summary> /// ID assigned to the event on the hero kit objet to interact with. /// </summary> [HideInInspector] public int eventID = -1; /// <summary> /// Time between clicks. /// </summary> private float clickTime; /// <summary> /// Click count (1=single-click, 2=double-click, etc) /// </summary> private int clickCount = 0; /// <summary> /// If this interval passes between clicks, the click count is reset. /// </summary> private float clickInterval = 0.5f; //------------------------------------------- // Interaction Types //------------------------------------------- /// <summary> /// On submit. /// </summary> /// <param name="data">The pointer event data.</param> public void OnSubmit(BaseEventData data) { if (data == null || sendNotificationsHere == null) return; // submitted on item if (inputType == InputType.onSubmit) { performAction(); } } /// <summary> /// On click or double click. /// </summary> /// <param name="data">The pointer event data.</param> public void OnPointerClick(PointerEventData data) { if (data == null || sendNotificationsHere == null) return; // get interval between this click and the previous one (check for double click) float interval = data.clickTime - clickTime; // if this is double click, change click count if (interval < clickInterval && interval > 0 && clickCount != 2) clickCount = 2; else clickCount = 1; // reset click time clickTime = data.clickTime; // clicked on item if (inputType == InputType.onClick && clickCount == 1) { performAction(); } // double-clicked item else if (inputType == InputType.onDoubleClick && clickCount == 2) { performAction(); } } /// <summary> /// Press down or begin drag. /// </summary> /// <param name="data">Pointer event data.</param> public void OnPointerDown(PointerEventData data) { if (data == null || sendNotificationsHere == null) return; if (inputType == InputType.onPress || inputType == InputType.onDrag) { performAction(); //GameObject go = getTargetGO(data); //database.menuActions.sendUIAction(panelID, slotID, template, isClicked, isPressedBegin, isPressedEnd, isDrag, go); //if (onPress) database.inputActions.addToPickList(database.inputActions.pressDownList, go); //if (onDrag) database.inputActions.addToPickList(database.inputActions.dragBeginList, go); } } /// <summary> /// Release press or end drag. /// </summary> /// <param name="data">Pointer event data.</param> public void OnPointerUp(PointerEventData data) { // the problem: only works on listener that was pressed down. For example, // if you drag icon from shortcut menu to crafting menu, the shortcut menu // panel calls onPointerUp. If you drag mouse over crafting menu (not slot) and // release mouse over a slot, nothing happens because the mouse did not start // dragging over the slot. //print ("aml: on pointer up"); if (data == null || sendNotificationsHere == null) return; if (inputType == InputType.onPress || inputType == InputType.onDrag) { performAction(); //GameObject go = getTargetGO(data); //database.menuActions.sendUIAction(panelID, slotID, template, isClicked, isPressedBegin, isPressedEnd, isDrag, go); //if (onPress) database.inputActions.addToPickList(database.inputActions.pressUpList, go); //if (onDrag) database.inputActions.addToPickList(database.inputActions.dragEndList, go); } } /// <summary> /// Dragging. /// </summary> /// <param name="data">Pointer event data.</param> public void OnDrag(PointerEventData data) { if (data == null || sendNotificationsHere == null) return; if (inputType == InputType.onDrag) { performAction(); //database.menuActions.sendUIAction(panelID, slotID, template, isClicked, isPressedBegin, isPressedEnd, isDrag, go); //database.inputActions.addToPickList(database.inputActions.dragList, go); } } //------------------------------------------- // General //------------------------------------------- /// <summary> /// Perform an action on the hero kit that can communicate with this listener. /// </summary> private void performAction() { if (actionType <= 1) { callEvent(sendNotificationsHere, stateID, eventID); } else if (actionType == 2) { passValues(sendNotificationsHere); } } /// <summary> /// Call an event in a state on a hero kit object. /// </summary> /// <param name="heroKitObject">The hero kit object.</param> /// <param name="stateID">ID assigned to the state on the hero kit object.</param> /// <param name="eventID">ID assigned to the event in the hero kit object.</param> private void callEvent(HeroKitObject heroKitObject, int stateID, int eventID) { if (heroKitObject != null) { if (stateID > 0 && eventID > 0) { if (heroKitObject.heroStateData.state == stateID - 1) { heroKitObject.heroListenerData.active = true; heroKitObject.heroListenerData.itemID = itemID; heroKitObject.heroListenerData.item = item; heroKitObject.PlayEvent(eventID - 1, gameObject); } } } } /// <summary> /// Pass values to this listener from a hero kit object. /// </summary> /// <param name="heroKitObject">The hero kit object.</param> private void passValues(HeroKitObject heroKitObject) { heroKitObject.heroListenerData.active = true; heroKitObject.heroListenerData.itemID = itemID; heroKitObject.heroListenerData.item = item; } } /// <summary> /// Data for a hero kit listener. /// </summary> public struct HeroKitListenerData2D { public bool active; public int itemID; public HeroObject item; } Add HeroKitListenerUI2D, not HeroKitListenerUI
  7. On Submit for 'Input Type' on HeroKitListenerUI https://docs.unity3d.com/ScriptReference/UI.Button.OnSubmit.html
  8. How can I convert this to the actual scene object to store and then call on with 'load scene' action?
  9. Nevermind, found the answer. Had to set the name to TorquePlayer not "Torque Player"... The script name, not apparent component name.
  10. I was looking into disabling the movement script component on my object (under/on which there's rigidbody, hero object set, collision, sprite, etc.) called "Torque Player (Script)". I've tried setting the name to 'Torque', 'Torque Player' and 'Torque Player (Script)' but it would not disable and threw no errors during gameplay. The object is a prefab, though, that has the script enabled. It wasn't a mistake with properly getting the object, since it logged doing so correctly. How does the name field work? Does it work on scripts?
  11. Requiring to set an object's velocity to 0 and turn kinematic to prevent movement. Haven't found an action for it. I also thought of being able to set the same action to Add/Substract from velocity in the X,Y values (for 2D) within the same "SetVelocity" action. Currently have looked at other actions like Physics2DOnOff but translating the structure has me a bit lost. I can accomplish the same just with a custom script on the object with more ease, but I'd like to utilize HeroKit. Current method I looked into was using GetGameObject action and then select the object like in TurnComponentOff.
  12. Just in case it isn't clear, it would behave like this, with groups in italics: The groups would just be for organization for the developer - and collapsible. This makes it easier to navigate to what's being worked on.
  13. Really anticipate needing this, but for events. The ability to create a collapsible tag/group alongside other events, under which equal events can be grouped. Functionally no different from behavior now, but the developer UX improves dramatically. Those groups do not need to be called or anything, only act as ways for organizing visually in the editor.
  14. Another question about attacks: is it possible to set up combos using hero object states? For example, there could be: [System](Attack Manager) = Turn state 'Attacking' to ON & wait 500 milliseconds, then turn state 'Attacking' to OFF & turn state 'Attack Cooldown' to ON & turn OFF [System](Attacking) = default OFF/FALSE [System](Attack Cooldown) = wait 100 milliseconds, then turn OFF [System](Combo Manager) = wait 300 milliseconds, then turn state 'Combo Enabled' to ON & turn OFF [System](Combo Enabled) = wait 200 milliseconds, then set Combo State = 0 & turn OFF [System](Combo State) = 0 [Attack](Normal) = If 'A' is pressed & state 'Attacking' is OFF & 'Combo State' = 0 & state 'Attack Cooldown' is OFF, then attack:normal & turn state 'Attack Manager' to ON & turn state 'Combo Manager' to ON & add 1 to Combo State [Attack](Combo 1) = If 'A' is pressed & state 'Attacking' is ON & state 'Combo Enabled' is ON & Combo State = 1, then attack:combo1 & turn state 'Combo Manager' to OFF & turn state 'Attack Manager' to OFF & turn state 'Combo Manager' to ON & turn state 'Attack Manager' to ON & add 1 to Combo State [Attack](Combo 2) = If 'A' is pressed & state 'Attacking' is ON & state 'Combo Enabled' is ON & Combo State = 2, then attack:combo2 & turn state 'Combo Manager' to OFF & turn state 'Attack Manager' to OFF & turn state 'Combo Manager' to ON & turn state 'Attack Manager' to ON & add 1 to Combo State
  15. This thread is partly to request help and partly to get my bearings on how to go about organizing actions in a hero object as a newb. In the game Super Metroid (or one of its offshoots), the character can have multiple types of attacks and in Zelda: OOT Link can have multiple kinds of armor. Setting this up using states, how is it that these can be setup? How I imagine it happening: you have multiple states and state types for a hero object, for example, setting up the names like this: [State type](State subtype). For Link in Zelda OOT and Samus in Super Metroid it would be like this: [Armor](Normal) [Armor](Water) [Armor](Fire) [Weapon](Normal) [Weapon](Chargeable) [Weapon](Freezing) For the armor, it would change appearance and give a certain effect (like "can breathe underwater"). For the weapon it wouldn't change appearance but would change the attack type, like switching guns. Next Question: Attributes (intelligence, agility ,etc.) from games like Diablo 2. A hero object would have a certain amount of these attributes. These can be done with states, right? [Attribute](Vitality) [Attribute](Strength) [Attribute](Agility) And then the hero object would have other states, which take into account the attributes: [Stats](Base Attack) = 10 + (STR*1.25) [Stats](Base Atk. Spd.) = 1/s - (AGI*.008) [Stats](Base Health) = 100 + (VIT*2.5) This would be how to set it up, right? What would be the best way to store attributes of a Hero Object, the enabling of its abilities? Can a hero object have multiple states running/enabled at once? Can, for the example of the armors, there be a variable stored somewhere to check if the hero should be even able to change states (like, 'if Link has water armor, enable changing to state of having water armor'). When I think of Link from Zelda:OOT, I think of the many multiple conditions limiting the character changing. For example, young link not being able to use certain items or wear certain things which older Link can. Maybe even younger link would have a totally separate inventory menu to older link. I'm going to study up the tutorials a bit more, but I noticed one of the tutorial links weren't working (the most basic one on what a hero object is) so, in case my understanding fails I wanted to make a post asking for some input. Like how to handle multiple armors and multiple weapons; if there needs to be separate states for every single item in the game that's not one-time consumable/runnable. Potions would also be a question on how to set up.
  • Create New...