playMaker

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jos Yule

Pages: [1] 2 3
1
Share New Actions / Re: ex2D Set Sprite action
« on: May 31, 2012, 09:14:53 AM »
Dang. I somehow missed the .atlas property on all exSprite instances. This can clean up the use of the Resources.Load() method i'm currently using to get an Atlas. However, you would then be limited to only changing the sprite to another in the current sprite atlas.

I'm not sure if i'm going to change how it works or not. I need to get some more use out of it to see if this is an issue or not.

I suppose i could also create a new action which would change the atlas the sprite used, or, using the current action, check to see if you include a name in the 'Atlas Name' property. If not, it uses the one in the .atlas property.

That might be the best bet, actually.

2
PlayMaker Help / Re: Help with Casting FsmObject to specific type.
« on: May 30, 2012, 11:50:57 AM »
Well, I solved it in a round-about kind of way.

Code: [Select]
exAtlas realAtlas = Resources.Load(atlasName.Value, typeof(exAtlas)) as exAtlas;

I've changed the required params to now be the Object with the exSprite, the sprite name and the atlas name. I then load the atlas via the Resources.Load() method.

This works for me, but i'm not sure of the cost (memory/cpu) of using the Resources.Load() method. I'm making an assumption (bad idea, i know) that the exAtlas is already loaded, as you are using it in your project, so this shouldn't use any more memory. But it is something that really needs to be tested.

Regardless, it would be great to have a way to add new variable types to PlayMaker.

I've posted it here.

Jos

3
Share New Actions / ex2D Set Sprite action
« on: May 30, 2012, 11:50:00 AM »
hello all.

I've created an ex2D Set Sprite action. You can use it to, well, set the sprite "image" of an exSprite.

There are 3 parameters:

1. The Game Object with the exSprite component
2. The name of the sprite which you wish to display
3. The name of the atlas which contains that sprite

That is it. Let me know of any problems or questions via this topic!

Thanks
Jos

ps. I've included the actual .cs file - you just need to drop it into your project somewhere. PlayMaker should then be able to pick it up and show it in the action list.

4
PlayMaker Help / Help with Casting FsmObject to specific type.
« on: May 30, 2012, 09:59:25 AM »
Hello.

I'm working on an ex2D action - "Set Sprite". The action will allow you to dynamically set the sprite of a Game Object which has an exSprite attached.

I've used the ExSpriteAnimationPlay action code as a base.

My problem is that you need to denote the exAtlas from which the sprite should be taken. This atlas lives in the Project Hierarchy. I've got a var setup to hold this reference:

Code: [Select]
[RequiredField]
[Tooltip("The Sprite Atlas to pull the new sprite from.")]
public FsmObject spriteAtlas;

I originally had the spriteAtlas var set as an exAtlas type:

Code: [Select]
public exAtlas spriteAtlas;
But then i couldn't drag/drop the actual atlas from the Project tab into this slot.

So, i'm now trying to figure out how to cast from FsmObject to the specific exAtlas type. This is what i'm doing now, which isn't working:

Code: [Select]
var realAtlas = (exAtlas)spriteAtlas.Value;
Any suggestions? Would love to know how to deal with non-fsm specific var's in Actions.

Thanks!
Jos

5
Share New Actions / Re: get gameObject ID
« on: May 30, 2012, 07:32:30 AM »
You might want to look into using C#'s System.GUID class. I don't actually know if it is available to Unity, but if it is, that's what i'd use to generate IDs.

6
Share New Actions / FingerGestures Actions - Swipe Bug
« on: May 29, 2012, 08:13:10 AM »
Hello.

I'm starting to use the Swipe set of gestures. I wanted to use the velocity param, but was getting a '0' value out of it.

Looking at the code (FingerGesturesDetectInput.cs), and the method FingerGestures_OnFingerSwipe, i can see the velocity being passed into the method, but no setting of the storeSwipeVelocity var. I've simply added:

Code: [Select]
storeSwipeVelocity.Value = velocity;
above the switch statement, and all seems well now.

Peace
jos

7
Share New Actions / Re: get gameObject ID
« on: May 28, 2012, 08:33:50 AM »
I'm a new user of Unity, but i'd just add a quick "might be a problem" FYI:

This probably isn't a good way to store data if you are serializing on shutdown/interruption on a mobile device. I don't know that IDs are deterministic from execution to execution.

Something to test anyway.

Peace
Jos

8
PlayMaker Help / Re: Making a deck/shuffling.
« on: May 25, 2012, 10:32:50 AM »
And here is a link to a demo of the Drag and Drop: link

There are 3 draggable items, and 4 drop targets. The 1st draggable has 2 valid drop targets. the 2nd has none. The 3rd a single valid target.

You can see snap over, snap back, and that when using the 1st draggable, it will snap over either of the two valid targets, when dragging between the two of them. This is what i needed the Array for, to keep a list of valid targets, when leaving other targets.

Some of the colour feedback on the draggables is not working fully correctly. FYI. Again, this is just a demo, mostly for myself, of how this is working for me now. :)

Jos




9
PlayMaker Help / Re: Making a deck/shuffling.
« on: May 25, 2012, 10:23:46 AM »
This is the FSM which deals with the Dragging - this FSM is on the same GOs that the FSM in the previous post is on. ie. Draggable items have both this FSM and the other one attached.


10
PlayMaker Help / Re: Making a deck/shuffling.
« on: May 25, 2012, 10:14:37 AM »
Here is an image of the FSM on the draggable objects, which deals with the Trigger Enter/Exit stuff.

I'm now using Tags and Child Of comparisons to ensure that i'm only able to drop on drop targets, rather then also on other draggables.


11
PlayMaker Help / Re: Making a deck/shuffling.
« on: May 25, 2012, 08:07:05 AM »
Have been working on Dragging and Dropping, with lots of feedback stuff. Has been going well. One thing that i didn't really have in my head is that i can use the variables in the FSM, rather then having scripts attached to GameObjects.

Also, i'm more and more bought into having an OOPish design, and not worry so much about MVC (or whatever). Getting this Drag'n'Drop stuff working has been illuminating, in the sense of "just do it and see what happens". I wouldn't want to do that whole project without any planning/design (and really, i've already done tonnes of that), but because of my inexperience with Unity, i did need to just do some work.

The FSMs to support the Drag and Drop, and feedback, are not too complex. A sprinkling of global events and variables, 4 FSMs - 1 on the drop target, 2 on the drag objects and 1 for the Finger Gestures Actions for detecting drag events.

So, forward movement! Now to figure out some more of the dynamic elements - instancing unique drop targets and drag objects.

j

12
PlayMaker Help / Re: Making a deck/shuffling.
« on: May 21, 2012, 12:22:38 PM »
Ya, i'm bought between wanting to use PM as my higher-level state keeper, but put all the code into methods/classes. Having actions which would then call into that, or encapsulate that functionality makes sense.

I've been trying to separate the visual from the model as much as possible, so i'm not sure about actually bundling the data and view together in a class/component on a (visual) GameObject.

I'm not new to programming (scripting or otherwise), but i am new to Unity, and its unique architecture. As with any new environment/toolset, knowing the language is the least of the learning needed.

I'll keep posting in this thread as things move forward.

Jos

ps. good to have a place to have a conversation about this stuff!

13
PlayMaker Help / [SOLVED] Re: HashTable - ContainsKey vs. Contains
« on: May 21, 2012, 12:16:53 PM »
Cool, thanks!

j

14
PlayMaker Help / Re: Making a deck/shuffling.
« on: May 17, 2012, 09:14:10 AM »
I've been thinking about moving the "actual" cards around, rather then using a simple index into a Architype array. That is probably a better way to do it.

My game is a bit more complex then a typical card game, but not as crazy as Magic The Gathering. I've got 4 suits, each with 4 "kinds". For example, my suits are "food", "person", "prop" and "creature". A "kind" of "person" could be "clown". We then have 5 clown cards, with values from 1 to 5. So our basic deck has 80 cards, 20 for each suit. Then we also have 18 special cards.

I have to not only keep track of the pool of available cards, but also used/discarded cards. This is so when the draw pool is emptied, we only shuffle in the ones that are out of play, excluding the ones currently in players hands.

I've also got "targets", each which can hold 3 cards, and there are always 4 in play. The players try to fill the targets with cards from their hand. So i need to keep track of cards in play on the targets too. And the targets themselves, as each is different (requires specific or generic cards to fill).

So, i've got a a template array, with all the Cards in the game, and a template array for all the Targets. A pool of available cards (pointers (indexes) into the Card template array). A pool of available Targets (pointers (indexes) into the Target template array). Arrays for the players hands (4 of them). An array which contains the current Targets (pointers). An Array for played/discarded cards. An Array for finished Targets. An array for each target currently in play, so four, which contain the cards currently on that Target.

I think that covers all the arrays i'd need :)

I'm still not sure about all the indirection/pointers. I think it would be easier/faster to just have the data itself available in these arrays, rather then pointing back into the template Arrays...

You've even further broken out the data, by splitting out the suit, type and strengths. That seems really third-normal form (from DB design). I'm not sure that i'd actually gain from that. I think moving the actual card data rep from array to array is more straight forward. The targets i can see keeping split out however.

I'm still designing, prototyping all this architecture, so as i go i get a better idea of what is going to work. Complicating this is that it is a network game, so i also have to send data over the wire about hands, targets, etc.

Appreciate the discussion about this stuff. It is hard to know if what you are doing makes sense without anyone else to bounce this stuff off.

Jos


15
PlayMaker Help / [SOLVED] HashTable - ContainsKey vs. Contains
« on: May 17, 2012, 08:32:53 AM »
Hello!

Looking at the code, the two only differ in the following method call

HashTableContains.cs:

Code: [Select]
containsKey.Value = proxy.hashTable.Contains(key.Value);
HashTableContainsKey.cs:

Code: [Select]
containsKey.Value = proxy.hashTable.ContainsKey(key.Value);
I can't find .Contains() on the msdn site, but .ContainsKey() is here: http://msdn.microsoft.com/en-us/library/kw5aaea4

What is the difference between the two?

Looking at the assembly browser version, .ContainsKey() actually just calls the .Contains() method under the hood, I think. In which case, can we remove one? I'd suggest the .Contains(), as it isn't in the msdn docs...

Thanks!
Jos

Pages: [1] 2 3