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 dronus86 · Jun 15, 2018 at 12:38 AM · designgrid based gamedelegateobject-oriented-programming

General and OOD advice,General and OOD advice based

Hi, I'm relatively new to objected oriented programming and design, and I have a few questions I'm looking for advice on. I'll also take any side-advice you can offer even if it's not related directly to the question but is related to something I said. Thanks!

1. I'm trying to work with a tile-based system. I've decided that it would be wise to keep track of all these tiles(for pathfinding and other things), and decided a static List is the way to go about it rather than FindAllObjectsWithTag(). Should a static list containing a reference to every created and destroyed tile exist in the Tile script, or should it exist in a secondary 'TileHelper' script that I've written for other purposes?

2. I've created a 'TileHelper' script. The intent was to be used to grab 'shapes' of tiles based off of the origin tile and other inputs. For example, a 3x3 square where the origin is in the center or a 5x5 cross where the origin is in the center. Is this bad design?

3. For several of the shapes in this TileHelper script, I use OverlapBox() to get the areas that will be hit. This works pretty well for most shapes (3x3 square), but for others it is not good (a cross that goes diagonal). I've been considering switching to the case where instead I just do math on the vector of the origin tile to get the location of the other tiles. Is there a quick and efficient way to get an object if you know it's exact location, or would it be better to store a Dict where the key is the Vector position and the value is Tile?

4. Using these helper functions, I want to be able to make very specific areas that can be targeted by certain spells, and areas that will be impacted by the spell based off of the spell and the targeted tile. I feel like creating a class Spell and then a bunch of descendants that are spells (SpellFireball, SpellIcewall, etc) is the wrong way to do this, but I'm not sure how each spell can have different ranges and areas that aren't just numbers but instead are sets of tiles relative to the origin tile passed in. I've been learning about delegate functions and feel like this is the direction I need to head in. Is this a good idea?

Thanks for reading and for any insight you can offer!

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

86 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 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 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

Reliable / intelligent user input handling 0 Answers

Using the Delegate Object design pattern in Unity 1 Answer

How to make different objects spawn on a grid pattern randomly? 1 Answer

Render All Squares in a Grid 0 Answers

How do you store instantiated tiles using a coordinate system? 2 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