Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ZeShmoutt · Aug 03, 2016 at 09:28 PM · c#scripting problemarchitecture

Effects architecture akin to Starcraft 2

Link to Reddit, if you want to see what others proposed


Hello, ladies and gentlemen.

Context : I'm a student in game design, making a game for my master's degree.
I worked alone for the first year, doing pre-production things and a small prototype. And in october I'll start the second year, where more people will work with me on the project (namely game designers, and a bunch of graphists and concept artists), all students in the same school.
The problem is that most of them probably don't know C#, but it will be the language I'll use (well, I'll probably be the only programmer).

So, I started to make some ScriptableObjects and things to allow non-programmers to actually contribute to the production without having to do anything in C#.

I started by doing something akin to StarCraft 2's Effects system used in the map editor : as an example, a simple grenade would be a Launch Missile effect, that on impact would make a Search Area effect to take all valid entities in an area around the impact point, and apply on those entities a Damage effect.

I made my EffectBase (ScriptableObject), whom which every other effect type will inherit. This EffectBase have a virtual function called ApplyEffect wihch will do everything the effect is supposed to do.
And of course I have some troubles. Wouldn't be real programmation if there wasn't any trouble, right ?

  • First, the targeting. In StarCraft, an effect has a specific targeting parameter, taken from a list. The most common are Source Unit, Source Point, Target Unit and Target Point.
    I have my Entity script to act as a replacement for Unit, an enum to choose what kind of targeting this effect should have, but I have no idea how to do it. Using all 4 as parameters in the ApplyEffect function ? But what would happen if one of them was null ?

  • Sub-part of that, how about effect that have a predefined targeting by design ? For example, it would make no sense for the Damage effect to target a point. It will always be an Entity. Should I make 2 enums, one for Source/Target and the other for Point/Entity, and hide or show in the inspector whatever is relevant depending on the effect ?

  • Lesser problem : for all the Area of Effect subtypes (namely conic, rectangular and spherical), I'm using either OverlapSphere or OverlapBox. Those functions are perfect for the job, and return a Collider array.
    Is there a quick way to get all Entities from this Collider array, or am I forced to do a loop through all the Colliders ?

That's all for now, I'll edit to add/remove things if necessary.

Thanks in advance for any help you could give !

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

How to deal with Classes and Scriptables objects ? 2 Answers

Is it ok to use nested classes, to cache and access components? 1 Answer

I can't Kill or Close the external exe that i already opened from the unity exe ? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges