Search Unity

Scripting Help needed - script kin of a plugin system

Discussion in 'Scripting' started by Eneco, Oct 7, 2013.

  1. Eneco

    Eneco

    Joined:
    May 28, 2013
    Posts:
    16
    Hello

    For a game I'm currently working i want to create a set of Debuffs/Buff that can be effect players and characters in C#.

    I'm not a coding noob, but i'm lack of coding techniques / processes like using namespaces correctly or inheritance.

    So i'm asking here for a little help how to go on on this problem.

    I want to create a basic script for a buff-system which includes a basic script work.
    When i want a "template"/ script that sits on top of that basic script, that can be used (like the "public class Buff: BuffSystem" or so) to create a new buff.
    all i need to do to create a new buff is to replace some lines of code and "rename" the script. Every new buff is added as a script file and the buff is added to a global list in eg. BuffSystem. And then i can call it by the name (i think is a little than that :D ) to trigger the effect. i think its like the "Car - SUV - Porsche" system?


    How do i start building up such a system? Useful tutorials/examples would also help!

    Thank you
     
  2. Cameron_SM

    Cameron_SM

    Joined:
    Jun 1, 2009
    Posts:
    915
    There are 100 ways to skin that cat.

    However, I generally follow this rule:

    If you can't see the obvious cases of polymorphism in your design, chances are it's not going to be polymorphic.

    I've done a few games that have systems similar to what you describe, none of them heavy relied on inheritance.
     
  3. Eneco

    Eneco

    Joined:
    May 28, 2013
    Posts:
    16
    sure there may be different solutions for that, but i think this way i can add/remove some "buffs" and carry them over to other games?

    otherwise what's a more practical solution for that?