Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Jackv949 · Dec 20, 2014 at 09:52 AM · classenum

How do I create a bunch of player abilities, with their own properties?

What I'm trying to do is create some kinds of list or enum to hold a bunch of premade player abilities. Currently I have:

 public enum Abilities
 {
     NormalShoot,
     MultiShot,
     Blink,
     FreezingFire,
     RapidFire,
     SelfRepair,
 }

Which was okay when using abilities was extremely basic - I could just use Abilities.MultiShot when I was trying to use that ability. The issue is I want some abilities to have an energy cost associated with them.

The only solution I could come up with was having an array of Ability objects (a class I would create with all the properties in in), but I don't think it's a good way to go about this.

What would be the best way to go about this?

Comment
Add comment · Show 1
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
avatar image f4bo · Dec 20, 2014 at 02:51 PM 0
Share

what it is not clear to me is: do you need to have each ability enabled but with different energy costs per player or rather to ENABLE different abilties at libitum for each player or both cases?

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Firedan1176 · Dec 20, 2014 at 10:37 AM

Create a property drawer.

Unity Technologies also has a tutorial on how to create a property drawer.

Comment
Add comment · Show 4 · Share
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
avatar image Jackv949 · Dec 20, 2014 at 12:16 PM 0
Share

A property drawer doesn't seem like it would help. Both those links say it's for UI and custom inspectors. All I wanna do is be able to create something like an Ability class, but have an enum or something similar of Abilities - I don't need to be able to create anything in the inspector or anything.

avatar image martin101 · Dec 20, 2014 at 02:56 PM 0
Share

Hey

https://www.youtube.com/playlist?list=PLt_Y3Hw1v3QSFdh-evJbfkxC$$anonymous$$_bjUD37n

in this playlist watch video 5th i think this is exactly what you need !!!

He is using a Parameter class, applying different Parameter to different scenarios there by having multiple Parameter class for multiple scenarios.

avatar image flckev martin101 · Apr 28, 2020 at 01:38 AM 0
Share

link does not work

avatar image Firedan1176 · Dec 21, 2014 at 09:53 PM 0
Share

You could create a dictionary which is an array with 2 variables.

I'm still kind of confused. Are you looking for something like this (from the tutorial I posted above)?

avatar image
0

Answer by getyour411 · Dec 21, 2014 at 10:55 PM

It's an oldie but still a goodie, especially for someone learning C#:

http://www.burgzergarcade.com/hack-slash-rpg-unity3d-game-engine-tutorial

Best to start from 1 you will learn a lot.

Comment
Add comment · Share
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

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

29 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to access Enum from another class from the same script 1 Answer

Accessing Enumeration from another script issue 1 Answer

Help integrating a category system 0 Answers

Overriding an inherited Enum? 1 Answer

PropertyDrawer: Enum to select extended class 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