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.


Topics - tomraegan

Pages: [1]
1
PlayMaker Help / Timeline Set Duration
« on: August 18, 2018, 03:25:37 PM »
Hi!

https://hutonggames.com/playmakerforum/index.php?topic=15465.15

This thread contains Timeline actions. It includes a Get Duration, which grabs the duration of the timeline without an issue. I want to change the duration of the timeline and then Set Duration. Set Duration does not yet exist as an action.

I was wondering if someone could help me by creating a Set Duration?

Here is the code for Get Duration:

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2017. All rights reserved.
/*--- __ECO__ __PLAYMAKER__ __ACTION__ ---*/

using System;
using UnityEngine;
using UnityEngine.Playables;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Timeline")]
[Tooltip("Get the current timelines duration. This action requires Unity 2017.1 or above.")]

public class  getTimelineDuration : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(PlayableDirector))]
[Tooltip("The game object to hold the unity timeline components.")]
public FsmOwnerDefault gameObject;

[Tooltip("Returns the current timeline duration in seconds as a float.")]
[UIHint(UIHint.Variable)]
public FsmFloat duration;
private double _duration;

[Tooltip("Check this box to preform this action every frame.")]
public FsmBool everyFrame;

private PlayableDirector timeline;

public override void Reset()
{

gameObject = null;
everyFrame = false;
duration = null;
}

public override void OnEnter()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
timeline = go.GetComponent<PlayableDirector>();

timelineAction();

if (!everyFrame.Value)
{
Finish();
}

}

public override void OnUpdate()
{

timelineAction();

}

void timelineAction()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null || timeline == null)
{
return;
}

_duration = timeline.duration;
duration.Value = (float)_duration;
}

}
}

Thanks!

2
PlayMaker Help / Get Property help [SOLVED]
« on: December 08, 2017, 04:37:59 PM »
Hi.


I'm trying to get my variable, grid_01_value into PlayMaker from a script, but I can't find evidence of it being read by my FSM. I'm using Get Property and dragged the component itself into the Target Object field. grid_01_value is a public variable and I can list it as the Property. I then store it as 01_int_display_g. I'm then trying to convert and view the result. This is where I can't get a result.

Here is the FSM.


The variable grid_01_value is set from this code:
Code: [Select]
[size=8pt]using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Read_From_Centre : MonoBehaviour {

public UICenterOnChild myGrid;
public int grid_01_value;

public GameObject[] gridItems = new GameObject[4];

public void knowWhatIsCentered(GameObject _centeredItem)
{
if(_centeredItem == gridItems[0])
{
print("item 0 selected");
grid_01_value = 0;
Debug.Log("grid_01_value = " + grid_01_value);
}
else if(_centeredItem == gridItems[1])
{
print("item 1 selected");
grid_01_value = 1;
Debug.Log("grid_01_value = " + grid_01_value);
}
else if(_centeredItem == gridItems[2])
{
print("item 2 selected");
grid_01_value = 2;
Debug.Log("grid_01_value = " + grid_01_value);
}
else
{
print("item 3 selected");
grid_01_value = 3;
Debug.Log("grid_01_value = " + grid_01_value);
}
}
// Use this for initialization
void Start () {

myGrid.onCenter = knowWhatIsCentered;
}

// Update is called once per frame
void Update () {
}
}[/size]

I'm a complete scripting n00b and the above is mostly copied, but it is working as intended. I attach this script to a GameObject and fill the Public field "My Grid" with the NGUI Scroll grid object. I then populate the other fields with the grid objects. All of this part works.


I've noticed the FSM state "Get and Convert Grid Value" doesn't pulse green when I click on the scroller. The debug console updates with the correct values, but my data isn't getting into PM.

edit: Forgot to mention that the NGUI Label , irrespective of my scroller selection, sits on 0.

I'd appreciate some help. Thanks.

3
PlayMaker Help / NGUI On Drop Question [SOLVED]
« on: December 04, 2017, 03:17:33 AM »
Hi. I've been reading the forums and the admin do a great job here.

In relation to NGUI, I've installed the Eco package and come across something strange. I'm following these instructions, posted by Jean a while ago:

Quote
1: open the ngui example11 scene
2: select the gameObject 3D/Stage/DragDropSurface
3: add the component "NGuiEventsToPlaymakerFsmEvents" to it
4: add a Fsm component to DragDropSurface as well
5: in the fsm, add a state with a global transition "NGUI / ON DROP" ( all ngui events are available in the transition menu under "global events"
6: double check that in the NGuiEventsToPlaymakerFsmEvents, the Drop entry turned green, this means, we have detected that you are actually implement the "NGUI / ON DROP" event.
7: run the scene, drop something onto the cube, and the fsm will receive the drop event.

Now, if you ae building a scene from scratch, it could simply be that you don't set up ngui properly to being with.
-- also, you may think that the gameobject you have adde the component NGuiEventsToPlaymakerFsmEvents received drop events, but actually doesn't, that's something you will need to verify outside playmaker

environment, like dropping a simply script that listen to drop events ( very much like "DragDropSurface" script provided in the example 11 scene.
[/size]

My problem is that the NGUI On Drop transition does not show up when I attempt to add it to the state. I can add various others, such as On Click, which then results in the Click entry turning green.

Is there a reason On Drop is not appearing?

Thanks kindly.

Pages: [1]