Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doors and buttons #12

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Doors and buttons #12

wants to merge 17 commits into from

Conversation

wannabegamedeveloper
Copy link
Collaborator

No description provided.

@omangbaheti omangbaheti self-requested a review November 3, 2022 13:48
private void Awake()
{
doorControllers = new List<DoorController>();
_button = transform.GetChild(1).gameObject;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not a sf reference? this is fine though tbh

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since it was going to be used by others. I thought it would be easier that way.


private void Start()
{
_counterTile = transform.GetChild(1).GetChild(0).gameObject;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kinda hacky, could be an sf especially if it requires two layers of getchild?

_buttons = new List<ButtonBehaviour>(buttonDictionary.Keys);
_values = new List<int>(buttonDictionary.Values);

foreach (var button in _buttons)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dictionaries are directly iterable, you dont need to split it and convert it into a list

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i tried
i think serializable dictionaries work diferent

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aite

if (tempOpen) return;
_buttonActivated = true;
for (int i = 0; i < _buttons.Count; i++)
if (_buttons[i] == button)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just do _index = buttonDictionary[button]; instead of the entire for() loop and eliminate the entire ConvertToDictionary() function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants