Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Corgi Engine - Complete 2D/2.5D Platformer [new v8.0 : advanced damage system]

Discussion in 'Assets and Asset Store' started by reuno, Dec 18, 2014.

  1. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @bravery > I think the moving platform script @NEHWind2 is referring to is MovingPlatform.
     
    NEHWind2 likes this.
  2. Fabioisriva

    Fabioisriva

    Joined:
    Feb 3, 2016
    Posts:
    15
  3. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
  4. LOGames

    LOGames

    Joined:
    Sep 4, 2016
    Posts:
    19
    Thought I'd show what I've been working on with the engine. All super temporary at the moment, but it's getting somewhere.

     
    Grafos, Boom_Shaka and reuno like this.
  5. Fabioisriva

    Fabioisriva

    Joined:
    Feb 3, 2016
    Posts:
    15
    at the end I managed to integrate it, but it doesn't seem smooth yet I also understand that Cinemachine are in constant develoment phase,so meanwhile its better i put step aside until it works natively with corgi and i think @reuno has plan to integrate to corgi it self:)
     
  6. AxelBoltok

    AxelBoltok

    Joined:
    Jun 26, 2017
    Posts:
    10
    Hello, on the script Health, when i select Flicker Sprite on Hit i have a problem, it only turns red the first gameobject that it finds (my enemy have separated parts of the body head, legs, etc) how could i make so it flicks the entire enemy, Thanks!
     
  7. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @AxelBoltok > You'll need to extend the Health class to implement that specifically for setups that can't be guessed by the engine, such as yours.
     
  8. Levrault

    Levrault

    Joined:
    Jan 22, 2018
    Posts:
    29
    Hi @reuno ,

    I'm still in Corgi Engine 4.5 since it juste impossible for me to upgrade with my current project. Sadly I got a save problem. I create my own progressmanager based on RetroAdventureProgressManager. When I play the game in the editor everything work fine, when my character take a upgrade, the upgrade is still loaded in the next scene.

    But When I build the game, nothing work... event the corgi engine event "levelCompleted" isn't trigger...when the same scene work fine in the editor.

    Do you have a solution ?

    Thanks
     
  9. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @Levrault > I've never heard of such an error, even on 4.5, and without more details (errors, exact chain of events and why the levelCompleted event wouldn't be fired) I can't guess what the problem is in your setup. I'd suggest comparing with the demo ones, assuming they're working, to see what you may have done differently. If the problem persists please use the support email, thanks.
     
  10. Levrault

    Levrault

    Joined:
    Jan 22, 2018
    Posts:
    29
    Alright I will tried to add mores informations.

    First of all here my ProgressManager, it almost the same has the RetroAdventure one. I just add a hack to force a reset wihtout deleting the folder (since deleting the folder didn't seems to work in build mode)

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using MoreMountains.Tools;
    4. using System.Collections.Generic;
    5. using MoreMountains.InventoryEngine;
    6. using MoreMountains.CorgiEngine;
    7. using UnityEngine.SceneManagement;
    8. using Managers;
    9.  
    10. namespace Managers {
    11.   [System.Serializable]
    12.   /// <summary>
    13.   /// A serializable entity to store retro adventure scenes, whether they've been completed, unlocked, how many stars were collected, and which ones
    14.   /// </summary>
    15.   public class GameScene {
    16.     public string SceneName;
    17.     public bool collectedUpgrade;
    18.   }
    19.  
    20.   [System.Serializable]
    21.   /// <summary>
    22.   /// A serializable entity used to store progress
    23.   /// </summary>
    24.   public class Progress {
    25.     public bool Flower = false;
    26.     public bool Dress = false;
    27.     public bool Shoes = false;
    28.     public bool KnowForShoes = false;
    29.     public bool InitialFlower = false;
    30.     public bool InitialDress = false;
    31.     public bool InitialShoes = false;
    32.     public bool InitialKnowForShoes = false;
    33.   }
    34.  
    35.   /// <summary>
    36.   /// The ProgressManager class
    37.   /// </summary>
    38.   public class ProgressManager : Singleton<ProgressManager>, MMEventListener<CorgiEngineStarEvent>, MMEventListener<CorgiEngineEvent> {
    39.  
    40.     // flower unlocked
    41.     public bool Flower;
    42.     // shoes unlocked
    43.     public bool Shoes;
    44.     public bool KnowForShoes;
    45.     // dress unlocked
    46.     public bool Dress;
    47.  
    48.     /// the list of scenes that we'll want to consider for our game
    49.     public GameScene[] Scenes;
    50.  
    51.     public bool InitialFlower { get; set; }
    52.     public bool InitialDress { get; set; }
    53.     public bool InitialShoes { get; set; }
    54.     public bool InitialKnowForShoes { get; set; }
    55.  
    56.     protected const string _saveFolderName = "MMProgress";
    57.     protected const string _saveFileName = "Progress.data";
    58.  
    59.     /// <summary>
    60.     /// On awake, we load our progress and initialize our stars counter
    61.     /// </summary>
    62.     protected override void Awake() {
    63.       base.Awake();
    64.       LoadSavedProgress();
    65.     }
    66.  
    67.     /// <summary>
    68.     /// Saves the progress to a file
    69.     /// </summary>
    70.     protected virtual void SaveProgress() {
    71.       Progress progress = new Progress();
    72.       Flower = CoopManager.Instance.Flower;
    73.       Shoes = CoopManager.Instance.Shoes;
    74.       Dress = CoopManager.Instance.Dress;
    75.       KnowForShoes = CoopManager.Instance.KnowForShoes;
    76.       progress.Flower = CoopManager.Instance.Flower;
    77.       progress.Shoes = CoopManager.Instance.Shoes;
    78.       progress.Dress = CoopManager.Instance.Dress;
    79.       progress.KnowForShoes = CoopManager.Instance.KnowForShoes;
    80.       progress.InitialFlower = Flower;
    81.       progress.InitialShoes = Shoes;
    82.       progress.InitialDress = Dress;
    83.       progress.InitialKnowForShoes = KnowForShoes;
    84.  
    85.       Debug.LogError("----SaveProgress----");
    86.       Debug.LogError("flow " + progress.Flower);
    87.       Debug.LogError("shoes " + progress.Shoes);
    88.       Debug.LogError("dress " + progress.Dress);
    89.       Debug.LogError("know " + progress.KnowForShoes);
    90.  
    91.       SaveLoadManager.Save(progress, _saveFileName, _saveFolderName);
    92.     }
    93.  
    94.     /// <summary>
    95.     /// A test method to create a test save file at any time from the inspector
    96.     /// </summary>
    97.     protected virtual void CreateSaveGame() {
    98.       SaveProgress();
    99.     }
    100.  
    101.     /// <summary>
    102.     /// Loads the saved progress into memory
    103.     /// </summary>
    104.     protected virtual void LoadSavedProgress() {
    105.       if (SceneManager.GetActiveScene().name != "level1_intro") {
    106.         Progress progress = (Progress) SaveLoadManager.Load(_saveFileName, _saveFolderName);
    107.         if (progress != null) {
    108.           Flower = progress.Flower;
    109.           Shoes = progress.Shoes;
    110.           Dress = progress.Dress;
    111.           KnowForShoes = progress.KnowForShoes;
    112.           CoopManager.Instance.Flower = progress.Flower;
    113.           CoopManager.Instance.Shoes = progress.Shoes;
    114.           CoopManager.Instance.Dress = progress.Dress;
    115.           CoopManager.Instance.KnowForShoes = progress.KnowForShoes;
    116.           InitialDress = progress.InitialDress;
    117.           InitialShoes = progress.InitialShoes;
    118.           InitialFlower = progress.InitialFlower;
    119.           InitialShoes = progress.InitialKnowForShoes;
    120.  
    121.           Debug.LogError("----LoadProgress----");
    122.           Debug.LogError("flow " + progress.Flower);
    123.           Debug.LogError("shoes " + progress.Shoes);
    124.           Debug.LogError("dress " + progress.Dress);
    125.           Debug.LogError("know " + progress.KnowForShoes);
    126.  
    127.         } else {
    128.           InitialDress = CoopManager.Instance.InitialDress;
    129.           InitialFlower = CoopManager.Instance.InitialFlower;
    130.           InitialShoes = CoopManager.Instance.InitialShoes;
    131.           InitialShoes = CoopManager.Instance.InitialKnowForShoes;
    132.         }
    133.       } else {
    134.         Debug.LogError("----ForceReset----");
    135.         CoopManager.Instance.Flower = false;
    136.         CoopManager.Instance.Shoes = false;
    137.         CoopManager.Instance.Dress = false;
    138.         CoopManager.Instance.KnowForShoes = false;
    139.         InitialDress = CoopManager.Instance.InitialDress;
    140.         InitialFlower = CoopManager.Instance.InitialFlower;
    141.         InitialShoes = CoopManager.Instance.InitialShoes;
    142.         InitialShoes = CoopManager.Instance.InitialKnowForShoes;
    143.         SaveProgress();
    144.       }
    145.  
    146.  
    147.       CoopManager.Instance.InitUpgradeOnLoad();
    148.     }
    149.  
    150.     /// <summary>
    151.     /// Loads the saved progress into memory
    152.     /// </summary>
    153.     protected virtual void HackedReset() {
    154.  
    155.       Progress progress = new Progress();
    156.       Flower = CoopManager.Instance.InitialFlower;
    157.       Shoes = CoopManager.Instance.InitialShoes;
    158.       Dress = CoopManager.Instance.InitialDress;
    159.       KnowForShoes = CoopManager.Instance.InitialKnowForShoes;
    160.       progress.Flower = CoopManager.Instance.InitialFlower;
    161.       progress.Shoes = CoopManager.Instance.InitialShoes;
    162.       progress.Dress = CoopManager.Instance.InitialDress;
    163.       progress.KnowForShoes = CoopManager.Instance.InitialKnowForShoes;
    164.       progress.InitialFlower = Flower;
    165.       progress.InitialShoes = Shoes;
    166.       progress.InitialDress = Dress;
    167.       progress.InitialKnowForShoes = KnowForShoes;
    168.       SaveLoadManager.Save(progress, _saveFileName, _saveFolderName);
    169.  
    170.       CoopManager.Instance.InitUpgradeOnLoad();
    171.     }
    172.  
    173.     /// <summary>
    174.     /// When we grab an item event, we update our scene status accordingly
    175.     /// </summary>
    176.     /// <param name="corgiStarEvent">Corgi star event.</param>
    177.     public virtual void OnMMEvent(CorgiEngineStarEvent corgiStarEvent) {
    178.       foreach (GameScene scene in Scenes) {
    179.         if (scene.SceneName == corgiStarEvent.SceneName) {
    180.           scene.collectedUpgrade = true;
    181.         }
    182.       }
    183.  
    184.       SaveProgress();
    185.     }
    186.  
    187.     /// <summary>
    188.     /// When we grab a level complete event, we update our status, and save our progress to file
    189.     /// </summary>
    190.     /// <param name="gameEvent">Game event.</param>
    191.     public virtual void OnMMEvent(CorgiEngineEvent gameEvent) {
    192.       Debug.LogError("DetectEvent");
    193.  
    194.       switch (gameEvent.EventType) {
    195.         case CorgiEngineEventTypes.LevelComplete:
    196.           Debug.LogError("Saved event has been send");
    197.           SaveProgress();
    198.           break;
    199.         case CorgiEngineEventTypes.GameOver:
    200.           GameOver();
    201.           break;
    202.       }
    203.     }
    204.  
    205.     /// <summary>
    206.     /// This method describes what happens when the player loses all lives. In this case, we reset its progress and all lives will be reset.
    207.     /// </summary>
    208.     protected virtual void GameOver() {
    209.       ResetProgress();
    210.     }
    211.  
    212.     /// <summary>
    213.     /// A method used to remove all save files associated to progress
    214.     /// </summary>
    215.     public virtual void ResetProgress() {
    216.       SaveLoadManager.DeleteSaveFolder(_saveFolderName);
    217.     }
    218.  
    219.     /// <summary>
    220.     /// OnEnable, we start listening to events.
    221.     /// </summary>
    222.     protected virtual void OnEnable() {
    223.       this.MMEventStartListening<CorgiEngineStarEvent>();
    224.       this.MMEventStartListening<CorgiEngineEvent>();
    225.     }
    226.  
    227.     /// <summary>
    228.     /// OnDisable, we stop listening to events.
    229.     /// </summary>
    230.     protected virtual void OnDisable() {
    231.       this.MMEventStopListening<CorgiEngineStarEvent>();
    232.       this.MMEventStopListening<CorgiEngineEvent>();
    233.     }
    234.   }
    235. }
    236.  
    Here my updrage script, his role his to set new ability to the player and create CorgiEngineEvent to force file to save.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using MoreMountains.Tools;
    5. using MoreMountains.CorgiEngine;
    6. using UnityEngine.Events;
    7. using UnityEngine.SceneManagement;
    8. using Prompt;
    9. using Managers;
    10.  
    11. namespace Interactions {
    12.  
    13.   /// <summary>
    14.   /// Unleash action and set animation
    15.   /// </summary>
    16.   [AddComponentMenu("Corgi Engine/Environment/Lever")]
    17.   public class Upgrade : PromptButtonActivated {
    18.     [Header("Trigged when used")]
    19.     /// the method that should be triggered when the key is used
    20.     public UnityEvent KeyAction;
    21.  
    22.     [Header("Upgrade settings")]
    23.     public string AbilityToEnable;
    24.     public string TargetedPlayer;
    25.     public int UpgradeId = 0;
    26.  
    27.     [Header("Dialogue settings")]
    28.     public DialogueZone DialogueZone;
    29.     public float timerBeforeFade = 1f;
    30.     protected Collider2D _collidingObject;
    31.     private Animator _animator;
    32.     private BoxCollider2D _boxCollider2D;
    33.     private SpriteRenderer _sprite;
    34.  
    35.     void Start() {
    36.       _animator = GetComponent<Animator>();
    37.       _sprite = GetComponent<SpriteRenderer>();
    38.       _boxCollider2D = GetComponent<BoxCollider2D>();
    39.  
    40.       if (CoopManager.Instance.GetProgressUpgradeStatus(AbilityToEnable)) {
    41.         gameObject.SetActive(false);
    42.       }
    43.     }
    44.  
    45.     /// <summary>
    46.     /// On enter we store our colliding object
    47.     /// </summary>
    48.     /// <param name="collider">Something colliding with the water.</param>
    49.     protected override void OnTriggerEnter2D(Collider2D collider) {
    50.       _collidingObject = collider;
    51.       if (_collidingObject.gameObject.GetComponent<Character>().PlayerID == TargetedPlayer) {
    52.         base.OnTriggerEnter2D(collider);
    53.       }
    54.     }
    55.  
    56.     /// <summary>
    57.     /// When the button is pressed, we check if we have a key in our inventory
    58.     /// </summary>
    59.     public override void TriggerButtonAction() {
    60.       if (!CheckNumberOfUses()) {
    61.         return;
    62.       }
    63.  
    64.       if (_collidingObject == null) { return; }
    65.  
    66.       StartCoroutine(HidePrompt());
    67.       TriggerKeyAction();
    68.       ZoneActivated();
    69.     }
    70.  
    71.     /// <summary>
    72.     /// Calls the method associated to the key action
    73.     /// </summary>
    74.     protected virtual void TriggerKeyAction() {
    75.       if (KeyAction != null) {
    76.         _animator.SetBool("Activated", true);
    77.         KeyAction.Invoke();
    78.         _boxCollider2D.enabled = false;
    79.       }
    80.     }
    81.  
    82.     /// <summary>
    83.     /// Call manager to upgrade player
    84.     /// </summary>
    85.     public void UpgradePlayer() {
    86.       CoopManager.Instance.UpgradePlayer(AbilityToEnable);
    87.       MMEventManager.TriggerEvent(new CorgiEngineStarEvent(SceneManager.GetActiveScene().name, UpgradeId));
    88.       MMEventManager.TriggerEvent(new CorgiEngineEvent(CorgiEngineEventTypes.LevelComplete));
    89.       MMEventManager.TriggerEvent(new MMGameEvent("Save"));
    90.     }
    91.  
    92.     public void AfterUpgrade() {
    93.       _sprite.enabled = false;
    94.       DialogueZone.GetComponent<BoxCollider2D>().enabled = true;
    95.       DialogueZone.StartDialogue();
    96.     }
    97.   }
    98. }
    99.  
    The problem happen only in build mode and I get no error... I try to debug everything but I just can said that corgi event just doesn't work in my setup. Here my build settings.

    upload_2018-10-21_15-33-34.png
     
  11. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @Levrault > I don't know what's wrong with your scripts, and unfortunately I can't debug them for you just by looking at this. As I said, you might want to compare with the engine's examples, no changes made, and see what you may have done differently. And again, please use the support email if the problem persists.
     
  12. AxelBoltok

    AxelBoltok

    Joined:
    Jun 26, 2017
    Posts:
    10
    I see, just asked because i thought it was a common issue, i made a script (simple and not optimized yet) to do it in the meantime that is actually working, when the flicker coroutine is called i added
    Code (CSharp):
    1. gameObject.BroadcastMessage("Flick");
    then i created a new script that will be attached to the sons where i need the sprite to flick
    Code (CSharp):
    1.     private SpriteRenderer rend;
    2.     private Color initialColor;
    3.     private Color tempColor = new Color32(255, 20, 20, 255);
    4.     private int contador = 0;
    5.     private float time = 0f;
    6.  
    7.  
    8.     void Start () {
    9.         rend = GetComponent<SpriteRenderer>();
    10.         initialColor = rend.color;
    11.     }
    12.  
    13.     void Update() {
    14.         if(contador>0){
    15.             time += Time.deltaTime;
    16.             if (time < 0.05f){
    17.                 rend.color = tempColor;
    18.             }
    19.             if (time > 0.05f){
    20.                 rend.color = initialColor;
    21.             }
    22.             if(time > 0.1f){
    23.                 time = 0f;
    24.                 contador--;
    25.             }
    26.         }
    27.  
    28.  
    29.     }
    30.  
    31.     void Flick(){
    32.         contador = 5;
    33.     }
    As i said not fully optimized yet but it works, hopefully is usefull to someone :)
     
    Muppo likes this.
  13. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    Simple but effective. Thanks for sharing @AxelBoltok

    PS: That "contador" betray yourself, didn't know there was more spanish speaking people here ;)

    Edit: fixed a typo.
     
    Last edited: Oct 22, 2018
    AxelBoltok likes this.
  14. Levrault

    Levrault

    Joined:
    Jan 22, 2018
    Posts:
    29
    @reuno finally, after rolling back to unity 2018.2.6f, I was enable to make event fire again. But I got a last problem.

    On the awake function of my ProgressManager, I'm calling ResetProgess on the first level only to reset all saved data. But I don't know why, in builds mode, the folder doesn't seems to be deleted. I try to change admin permission of my exec but the problem seems to persist. Does it was an issue on corgi engine 4.5 ?

    Code (CSharp):
    1.     if (SceneManager.GetActiveScene().name == "level1_intro") {
    2.         Debug.LogError("Reset Progress");
    3.         ResetProgress();
    4.       } else {
    5.         LoadSavedProgress();
    6.       }
    Thanks
     
  15. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @Levrault > Please use the support email.
    @AxelBoltok > Thanks a lot for sharing this. If you do a cleaned up version, I can add it to the extension repo if you want.
     
  16. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    696
    @reuno So I was wondering how coupled are the systems in the Corgi Engine. I am asking because I am looking to build a game that is more of an RPG in the platformer environment so systems like the inventory system, weapon system, dialog system, etc. are things that I am going to have very specific requirements for however building proper platformer controls is something I feel would take me way to long to understand and implement well.

    Is it possible to use only the physics / collision parts of the Corgi Engine but implement everything else custom (or use a different library if I think I need to like the ProCamera2D for example) or are the systems tightly coupled to each other where I would be fighting to do something like that?
     
  17. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @ryanzec > I try to keep coupling to a minimum, to the limit that it doesn't become harder to use.
    The Inventory Engine is its own asset, so it really works on its own and has zero coupling with the Corgi Engine.
    It's absolutely possible to just use the controller (so collisions/forces) and do everything else on your own.
    Still, if you run into something where you think coupling could be reduced, just let me know and I'll see what I can do.
     
  18. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    696
    @reuno So I am trying to get a very basic example working without luck. I have a game object with a sprite and a box collidor, regidbody2d, CorgiController, Character, and Character Horizontal Movement script on it with layer of Player and another object with a sprite box coillidor with a layer of Platforms and the character properly fall onto the platform without going through after setting up the layers in the controller however when I press the A / D keys, not happens and sure what I am doing wrong (I looked at the Character Horizontal Movement script but did not see anything that was looking at input to move the character).
     
  19. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @ryanzec > Have you tried checking the doc and tutorials? They explain all there is to know about character creation. It's hard to guess what you're doing wrong here. I'd say check the tutorial/doc and compare with the many examples included in the package.
     
  20. AxelBoltok

    AxelBoltok

    Joined:
    Jun 26, 2017
    Posts:
    10
    Hello, i made a custom AI brain function and i have attached the Auto Respawn script with both bools on true, when i kill the AI and later i die, when the AI respawns AI Brain script is disabled, causing the AI to stop working properly (also damage on touch script), does anyone have the same problem?
     
  21. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    696
    @reuno, I got the minimal scene working, I was just missing the input manager component in my scene. I do have some questions / comments as it relates to stuff I saw in the minimum requirements video:

    1. The video make it seem like the GameManager is required however it only stores stuff as it related to live (maximum, current, and game over scene) however those really don't relate to my game as this game in really a RPG and not a platformer in the true sense, it just happens to play like a platformer from a visual / physics perspective. Am I go to run into any issue with the physics part of the engine without the game manager (my basic test worked fine without it but I am doing nothing more than move a character around that can jump).
    EDIT: It seems like if you don't have this it is also auto added to a new game object so my question on #2 applies here as well.

    2. The video makes mention that the GUIManager is not required however when I removed that and started the game, a game object called New Game Object was created that added the GUIManager to the scene (a game object of the same name was also added to the scene in the video when you did it). Again, the way the GUI looks to be setup is something that will not be able to use as the GUI for my game is going to be very different than that of a standard platformer game. Can I assume that if the GUIManager has nothing set on it, it should not cause a problem? If so, it would be cool to not have that automatically created (but again, if it won'y break anything, than I am not too worried about it).

    Outside of that, everything for my basic testing seems pretty good as least for the prototype stage I am in.

    Thanks for you quick replies.
     
    Last edited: Oct 23, 2018
  22. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    696
    @reuno So this it something weird to me that I noticed and not sure it is intended behaviour or not. I setup the maximum slope angle for my corgi controller script to be 60 and as far as being able to walking on slopes below that and not able to walk on slopes above that, that all worked as expected however the character is still able to jump on a slope greater than 60 and not fall down:

    corgi-engine-slope-issue.png

    Is this the expected default behaviour? If so, it there a way to make sure if the player jumps on a slope greater than the defined maximum slope angle, the player will automatically slide down (as well as not be able to jump on angle greater than the defined maximum slope angle)?
     
  23. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @AxelBoltok > You probably have your character's Health set to destroy on death.
    @ryanzec > The game manager has nothing to do with physics. If it gets "auto added" that's probably because something in your scene is referencing it. If you feel like you absolutely don't want it, code it out. Same thing for the GUIManager. And yes, that's the expected behavior for slopes. There's no slide down ability. You can check a full list of abilities on the asset's page. Please use the support email if you have more questions, thanks.
     
  24. admadea

    admadea

    Joined:
    Oct 26, 2017
    Posts:
    4
    Hey, thanks again for your help back in September, now I need help again. I'm using my modified dash ability as an attack, but I can't seem to get knockback on the players end of things working. Enemies respond properly, but I think the dash ability's movement is overriding the knockback from the DamageOnTouch script? Here's my code, in case the problem stems from something I've written.
    Code (CSharp):
    1. using MoreMountains.CorgiEngine;
    2. using System.Collections;
    3. using UnityEngine;
    4.  
    5.  
    6. [RequireComponent(typeof(MoreMountains.CorgiEngine.DamageOnTouch))]
    7. [AddComponentMenu("Corgi Engine/Character/Abilities/Character Dash")]
    8. public class DashAttack : MoreMountains.CorgiEngine.CharacterDash
    9. {
    10.     public float vertDashForce = 1f;
    11.  
    12.     private DamageOnTouch damageOnTouch;
    13.  
    14.  
    15.  
    16.     // Use this for initialization
    17.     protected override void Start()
    18.     {
    19.         base.Start();
    20.  
    21.  
    22.     }
    23.  
    24.     protected void Awake()
    25.     {
    26.         damageOnTouch = GetComponent<DamageOnTouch>();
    27.  
    28.        
    29.     }
    30.  
    31.     protected void FixedUpdate()
    32.     {
    33.         if (_movement.CurrentState != CharacterStates.MovementStates.Dashing && damageOnTouch.enabled)
    34.         {
    35.             damageOnTouch.enabled = false;
    36.         }
    37.     }
    38.  
    39.  
    40.     //Majority of overrides start here
    41.  
    42.     protected override void Initialization()
    43.     {
    44.         base.Initialization();
    45.  
    46.     }
    47.  
    48.     protected override void HandleInput()
    49.     {
    50.         base.HandleInput();
    51.     }
    52.  
    53.     public override void ProcessAbility()
    54.     {
    55.         base.ProcessAbility();
    56.         // If the character is dashing, we cancel the gravity
    57.        /* if (_movement.CurrentState == CharacterStates.MovementStates.Dashing)
    58.         {
    59.             _controller.GravityActive(false);
    60.             _controller.SetVerticalForce(0);
    61.         }*/
    62.  
    63.        
    64.         // we reset our slope tolerance if dash didn't end naturally
    65.         if ((!_dashEndedNaturally) && (_movement.CurrentState != CharacterStates.MovementStates.Dashing))
    66.         {
    67.             _dashEndedNaturally = true;
    68.             _controller.Parameters.MaximumSlopeAngle = _slopeAngleSave;
    69.         }
    70.  
    71.  
    72.     }
    73.  
    74.     public override void StartDash()
    75.     {
    76.         base.StartDash();
    77.     }
    78.  
    79.     public override void InitiateDash()
    80.     {
    81.         base.InitiateDash();
    82.         if (!damageOnTouch.enabled)
    83.         {
    84.             damageOnTouch.enabled = true;
    85.         }
    86.     }
    87.  
    88.     protected override IEnumerator Dash()
    89.     {
    90.         // if the character is not in a position where it can move freely, we do nothing.
    91.         if (!AbilityPermitted
    92.             || (_condition.CurrentState != CharacterStates.CharacterConditions.Normal))
    93.         {
    94.             yield break;
    95.         }
    96.  
    97.         // we initialize our various counters and checks
    98.         _startTime = Time.time;
    99.         _dashEndedNaturally = false;
    100.         _initialPosition = this.transform.position;
    101.         _distanceTraveled = 0;
    102.         _shouldKeepDashing = true;
    103.         _dashDirection = _character.IsFacingRight ? 1f : -1f;
    104.         _computedDashForce = DashForce * _dashDirection;
    105.        
    106.  
    107.         // we prevent our character from going through slopes
    108.         _slopeAngleSave = _controller.Parameters.MaximumSlopeAngle;
    109.         _controller.Parameters.MaximumSlopeAngle = 0;
    110.  
    111.         // we keep dashing until we've reached our target distance or until we get interrupted
    112.         while (_distanceTraveled < DashDistance && _shouldKeepDashing && _movement.CurrentState == CharacterStates.MovementStates.Dashing)
    113.         {
    114.             _distanceTraveled = Vector3.Distance(_initialPosition, this.transform.position);
    115.  
    116.             // if we collide with something on our left or right (wall, slope), we stop dashing, otherwise we apply horizontal force
    117.             if ((_controller.State.IsCollidingLeft || _controller.State.IsCollidingRight))
    118.             {
    119.                 _shouldKeepDashing = false;
    120.                 _controller.SetForce(Vector2.zero);
    121.             }
    122.             else
    123.             {
    124.                 if (_distanceTraveled <= (DashDistance / 4f) && _movement.CurrentState == CharacterStates.MovementStates.Dashing)
    125.                 {
    126.                     //If the dash is in it's first third
    127.                     //It should disable Gravity, and apply a vertical force for the duration
    128.                     //Else if it is greater and gravity isn't enabled, enable gravity
    129.                     Debug.Log("Dash is in first Fourth");
    130.  
    131.                     _controller.GravityActive(false);
    132.                     _controller.SetVerticalForce(vertDashForce);
    133.                 }
    134.                 else if (_distanceTraveled >= (DashDistance / 4f) && _movement.CurrentState == CharacterStates.MovementStates.Dashing)
    135.                 {
    136.                     _controller.GravityActive(true);
    137.                    
    138.                 }
    139.  
    140.                 _controller.SetHorizontalForce(_computedDashForce);
    141.             }
    142.             yield return null;
    143.         }
    144.  
    145.         StopDash();
    146.     }
    147.  
    148.     public override void StopDash()
    149.     {
    150.         base.StopDash();
    151.  
    152.         if (damageOnTouch.enabled)
    153.         {
    154.             damageOnTouch.enabled = false;
    155.         }
    156.     }
    157.  
    158.     protected override void InitializeAnimatorParameters()
    159.     {
    160.         base.InitializeAnimatorParameters();
    161.     }
    162.  
    163.     public override void UpdateAnimator()
    164.     {
    165.         base.UpdateAnimator();
    166.     }
    167.  
    168.  
    169.  
    170. }
    Also, another quick question; how would I introduce the ability for the player to "charge" the dash while the button is held down, up until a limit? I plan on adding a few powerup into the game that affect things like max charge distance, height of dash, charge time, and damage.
     
  25. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @admadea > I can't debug your code for you, especially without context :)
    I'd suggest tracking the chain of events to understand what's happening. There are multiple examples of fast moving objects applying knockback, projectiles for example, I'd start with that. As for charge, you have an example of it in the Weapon class.
     
  26. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    231
    Are enemies with the Character Fly ability immune to knockback? I can't seem to get it to work on them unless I deactivate the ability/permission
     
  27. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    When respawn, camera is not teleported to the last check point. Didn't really noticed it until I have set long distance checkpoints.
    Can I suggest this camera reset works as teleport does on a future release? (instant teleport and / or fade to black features)

    Thanks.
     
    RENZEYU likes this.
  28. ThoZ

    ThoZ

    Joined:
    Apr 21, 2013
    Posts:
    29
    managed to implement my first custom character abilite :)
    WallClimb
     
    MisterDeum and Mindjar like this.
  29. ThoZ

    ThoZ

    Joined:
    Apr 21, 2013
    Posts:
    29
    @Muppo:

    The Camera Controller has a boolean Instant Reposition Camera on Respawn
    Is this what you are looking for?
     
  30. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    I know, I requested it myself some time ago to @reuno and I want to apologize, it wasn't the camera script fault but my custom one, I double checked this time. However, the fade to black addition could be nice, I guess.

    @ThoZ That WallClimb looks neat!
    How did you approached it?
     
  31. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @ThoZ > That's a great ability, good job! (And thanks for pointing to the right setting!)
    @Muppo > You can add the fade to black by extending, it's a one liner :)
     
  32. ThoZ

    ThoZ

    Joined:
    Apr 21, 2013
    Posts:
    29
    @Muppo
    First i thought about the mechanic (wallclimb, but not forever). It has a resource (kind of like ammo), when it is empty, you can't wallclimb anymore and it gets canceled.

    The wallclimbing itself is a combination of WallClinging and the Ladder Script. Also had to overwrite the WallJump Method, so it is possible to walljump out of the new WallClimbing State.
     
    Muppo, Boom_Shaka and reuno like this.
  33. NEHWind2

    NEHWind2

    Joined:
    Jan 7, 2016
    Posts:
    31
    Hello everyone!

    I'm making a game modeled after Mega Man X and the first thing that my testers mention is always that my character can't shoot outwards while clinging to a wall. I was just curious if anyone has ever written an extension allowing that, or if anyone has any advice on how to make it happen myself. I know it's a long shot but I'm no programmer so I thought I'd ask. Currently characters will shoot straight into the wall while clinging, which plays the sound and spawns the shot for a brief moment, so even a way to disable the ability to shoot while using Wall Cling would be helpful! If anyone has any ideas I would be very thankful to hear them!

    @reuno said it was on the list to be added officially a bit ago but since I've never seen anyone else request it I figure it's pretty low priority. It's a very specific feature so that's natural, but I don't think it's ever been brought up here for others to show support for the feature if they're interested in it. A lot of fun new enemies, bosses and creative level designs could be possible if players can attack from a wall, now more than ever with the new AI system!
     
  34. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    @reuno > It took more than one line but looking at the fading coroutines on the teleport, finally achieve what I want. It goes easier everyday to work with your code.

    @ThoZ > Thanks mate, in case I need it, I'll try your ideas.

    @NEHWind2 > Just suppouse, What if you override weapon direction when player is wallcling?
     
    reuno likes this.
  35. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @NEHWind2 > As @Muppo said, you need to override the weapon's direction while wallclinging.
    @Muppo > That's just you getting better and better :)
     
    Muppo likes this.
  36. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    231
    I'd appreciate an answer
     
  37. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    @Grafos
    Tested it quickly on default RetroAI level and it seems both flying and goin on a path enemies ignore knockback and stompable feature as well. Have to test it more deeper but it seems that way. Let's see what @reuno can tell us about this topic.
     
  38. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @Grafos > Yes, they are immune to knockback, as their ability sets their forces every frame to keep them in place.
     
  39. skayster

    skayster

    Joined:
    Aug 12, 2017
    Posts:
    46
    Have enemy drops been requested and if so is it high or low on the wishlist?
     
  40. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @skayster > It's been requested a lot and it's in the top 20 of most requested features.
     
    skayster likes this.
  41. Muppo

    Muppo

    Joined:
    Sep 28, 2016
    Posts:
    242
    Didn't remember if I requested it before, just in case, it have my vote too.

    @reuno , I've change the KeyOperatedZoneExtend and now it checks for required amount of keys no matter wich inventory or if they're stackable or not, as far as they have the same ID.

    Can you submit it to the repo replacing the old one?
     
    Last edited: Oct 27, 2018
  42. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @Muppo > Sure, send me the updated file.
     
  43. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    Good news everyone, I've just released v5.2 of the Corgi Engine to the Asset Store. Expect a few days/weeks of delay as Unity validates the package.

    This new version introduces the most requested ability on my todo list : pulling stuff. So now you'll be able to create Pullable objects, powered by a CorgiController, and pull and push them as you please. Time control is also introduced (in a much more advanced way than before) and a time control ability and time zones should allow you to go crazy with your timescale. It also features a bunch of requested enhancements, and of course fixes all reported bugs to date.

    I hope you'll like this new version!

    Here are the full release notes :
    - Adds new push and pull mechanisms, and a dedicated push/pull button entry
    - Adds the CharacterTimeControl ability, allowing a character to slow down time (or speed it up) at will at the press of a button
    - Adds Time Zones, zones where you can define a new timescale for a certain duration, or as long as the player character is inside
    - Adds a new AI Decision : AIDecisionLineOfSightToTarget
    - Adds AIDecisionTargetIsAlive, a new AI decision evaluating whether or not the current target is alive
    - Adds a better button activation system (and a new button prompt)
    - Adds more security measures to the LevelManager's Points of Entry system
    - Adds better respawn options for MovingPlatforms
    - Adds a new EquippedAnimationParameter to the Weapon class, to let your animator know what weapon is currently equipped, at all times
    - Adds more consistency to jump conditions
    - Adds a Tolerance attribute to the falling platform component
    - Fixes a bug that could happen with long weapon delays
    - Fixes a bug with projectile weapon spread with only one projectile
    - Fixes an attachment issue with a secondary weapon
    - Fixes a few water and death related bugs.
    - Fixes a potential null state in weapons when initialized improperly
    - Fixes a bug that prevented jumping down from a one way platform when stuck in a tunnel
    - Removes GUIManager coupling in Input and Level Managers
    - IMButton methods are now nullable
    - Improves the way events are triggered.
    - Adds a welcome window.
    - Changes the jetpack binding from left ctrl to 2 to avoid conflicts with Unity's native shortcuts in 2018.2.11+
    - Massive MMTools update
    - Requires Unity 2018.2.6 or more
     
  44. shredingskin

    shredingskin

    Joined:
    Nov 7, 2012
    Posts:
    242
    I upgraded a backup of my project and I get this error:

    UnassignedReferenceException: The variable StandingOn of CorgiController has not been assigned.
    You probably need to assign the StandingOn variable of the CorgiController script in the inspector.
    MoreMountains.CorgiEngine.CharacterJump.EvaluateJumpConditions () (at Assets/CorgiEngine/Common/Scripts/Agents/CharacterAbilities/CharacterJump.cs:234)
    MoreMountains.CorgiEngine.CharacterJump.JumpStart () (at Assets/CorgiEngine/Common/Scripts/Agents/CharacterAbilities/CharacterJump.cs:311)
    MoreMountains.CorgiEngine.AIActionJump.Jump () (at Assets/CorgiEngine/Common/Scripts/Agents/AI/Advanced/AIActionJump.cs:42)
    MoreMountains.CorgiEngine.AIActionJump.PerformAction () (at Assets/CorgiEngine/Common/Scripts/Agents/AI/Advanced/AIActionJump.cs:32)
    MoreMountains.Tools.AIState.PerformActions () (at Assets/CorgiEngine/ThirdParty/MMTools/AI/AIState.cs:101)
    MoreMountains.Tools.AIState.UpdateState () (at Assets/CorgiEngine/ThirdParty/MMTools/AI/AIState.cs:51)
    MoreMountains.Tools.AIBrain.Update () (at Assets/CorgiEngine/ThirdParty/MMTools/AI/AIBrain.cs:59)


    But the game runs fine, and all my characters/enemies get assigned the StandingOn variable on play. Any idea what it can be, or should it be of any concern ?
     
  45. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @shredingskin > I'm guessing you've changed something, but without context it's hard to tell what. Check if the problem happens with a fresh install of the engine, in a blank project. If it doesn't, then it's something you've changed.
     
  46. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    congratulation on the new release :)
     
    reuno likes this.
  47. phateRM

    phateRM

    Joined:
    May 1, 2018
    Posts:
    5
    Hi, I am trying to integrate cinemachine2D with Corgi Engine. When populating the Follow property of the CM virtual camera, I have problems with specifying the same character as in the level manager. I tried dragging the same prefab from the Assets to the CM virtual camera follow parameter, but that does not work.
    How can I specify in CM the same player which is specified in the level manager and which is not in the project hierarchy?
    Thanks for any help.
    Dan
     
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
  49. shredingskin

    shredingskin

    Joined:
    Nov 7, 2012
    Posts:
    242
    I'm pretty sure I didn't change any of the logic scripts.
    Did the layer management changed in any way ?
    I'm importing in a new project to see if I can narrow down the problem.
    Is that standingOn a new check or was it before ?
    EDIT: Seems the problem is with only a chacter that jumps after a while, here are the parameters:


    Anything looking bad here ?
     
    Last edited: Oct 30, 2018
  50. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,915
    @shredingskin > As I said, it's a very simple test : does the problem happen in a fresh install of the engine?
    If not then, again, you probably changed something. If the problem persists, please use the support email and give me more info on how to reproduce from a vanilla install.