Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

I need just an opinion on this script setup that I have (Image inside)

Discussion in 'Scripting' started by TheForsaken95, Jan 16, 2015.

  1. TheForsaken95

    TheForsaken95

    Joined:
    Aug 29, 2014
    Posts:
    30
    I am making an adventure game similar to Skyrim, but holds true to MOBA game abilities (equivalent to smite in the 3rd person aspect)

    Everything works great, and my script works universally for all objects that want to cast abilites (Such as AI mages, bloated zombies, skeleton archers, and the player, ect.)

    I just have a daunting feeling that I did something wrong, and that my script layout is inefficient and n00b.

    Here is a picture of the setup that I built my ability "engine" on.
    http://tinypic.com/r/2p56w/8
     
  2. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,377
    You can post images in the thread with the img bracket tag

     
  3. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,377
    What's wrong with your design? It sounds fine enough to me...
     
  4. TheForsaken95

    TheForsaken95

    Joined:
    Aug 29, 2014
    Posts:
    30
    I'm just somewhat new to programming and it seems as if I'm passing around the same variables in a circle. The original GameObject that cast the spell is referenced (For locations/animator/uniqueness) in each step, and is then passed over to the next step. Is that normal?
     
  5. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,377
    You have a class that handles the casting, and another that handles the targeting. You need to pass the data to it so it can perform the targeting. That's normal.

    Design wise, this is normal.

    As for HOW you pass that data around, and the implementation of this, I can't judge that at all since I haven't seen it.
     
    TheForsaken95 likes this.
  6. TheForsaken95

    TheForsaken95

    Joined:
    Aug 29, 2014
    Posts:
    30
    When passing data from one object to another, I try to do it locally (Within function parameters). However there was no need for a function within splashtargettingcontrol.cs since it only exists when I need it, so I passed in the original game object through a public variable rather than as a parameter. I was a little concerned about how that would effect me in the future.

    You've been a lot of help in making me feel confident about the system I am building my game on, your time is much appreciated :) Thanks!