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

Pages: [1] 2 3
1
Playmaker Help / How to call PlayMaker Actions from script?
« on: April 10, 2013, 11:40:18 AM »
Is there a way to call a PlayMaker Action from a script? If yes, can someone post a code snippet?

I'm specifically trying to figure out how to obtain multiple return values from one action. For example, Raycast From Screen, which can return a Bool and a GameObject.

2
Share New Actions / Get File Name By Loop
« on: February 12, 2013, 10:03:44 PM »
This script returns the names of all files in a Resource Folder. You need to set this script up as a loop to extract each file name. I've attached a sample. Fields are:

  • Folder Name: enter the path where files are located inside the Resources directory. Leave this field empty to get all files in the Resource folder. Example usage: Creatures/Monsters/Ghosts
  • File Name: returns name of the next file in the directory.
  • Loop Event: A file was found. Do something and return to the loop.
  • No Hit Event: No files were found in directory. Exit loop early.
  • Finished Event: The Loop Event has been called for all files in the loop. Exit the loop.

This script is based on Jean's Get Next Ray Cast All Hit script.

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2012. All rights reserved.

using UnityEngine;
using System.Collections;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Files")]
[Tooltip("Get the name of a file, using its index, in a specified resource folder.")]
public class GetFileNameByLoop : FsmStateAction
{
[Tooltip("The name of the folder where the file is located. If no folder name is entered, all Resource files are returned.")]
public FsmString folderName;

[Tooltip("The name of the file.")]
[UIHint(UIHint.Variable)]
public FsmString fileName;

[ActionSection("Hit")]

[Tooltip("Event to send to get the next child.")]
public FsmEvent loopEvent;

[Tooltip("Event to send if there is no hit at all")]
public FsmEvent noHitEvent;

[Tooltip("Event to send when there are no more hits to loop.")]
public FsmEvent finishedEvent;


public override void Reset()
{
folderName = null;
fileName = null;

loopEvent = null;
finishedEvent = null;
noHitEvent = null;
}

// cache the hits
private Object[] hits;

// increment a hit index as we loop through the hits
private int nextHitIndex;

public override void OnEnter()
{
if (nextHitIndex==0)
{
DoGetFileAll();
}

// no items found
if (hits.Length==0)
{
nextHitIndex = 0;
Fsm.Event(noHitEvent);
Fsm.Event(finishedEvent);
Finish();
return;
}

// final item
if (nextHitIndex>=hits.Length)
{
nextHitIndex = 0;
Fsm.Event(finishedEvent);
Finish();
return;
}

Debug.Log("getting index"+nextHitIndex );
fileName.Value = hits[nextHitIndex].name;

nextHitIndex++;

Fsm.Event(loopEvent);

Finish();
}


void DoGetFileAll()
{
hits = Resources.LoadAll(folderName.Value);
}

}
}

3
Share New Actions / Get File Name By Index
« on: February 12, 2013, 09:55:19 PM »
This script returns the name of a file at a specific index in a Resource Folder. Fields are:

  • Folder Name: enter the path where files are located inside the Resources directory. Leave this field empty to get all files in the Resource folder. Example usage: Creatures/Monsters/Ghosts
  • File Index: Index (position) of the file in the folder. Starts at 0.
  • File Name: returns the number of the file at the specified index.

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2012. All rights reserved.

using UnityEngine;
using System.Collections;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Files")]
[Tooltip("Get the name of a file, using its index, in a specified resource folder.")]
public class GetFileNameByIndex : FsmStateAction
{
[Tooltip("The name of the folder where the file is located. If no folder name is entered, all Resource files are returned.")]
public FsmString folderName;

[Tooltip("The index of the file inside the folder. Index starts at 0.")]
public FsmInt fileIndex;

[Tooltip("The name of the file.")]
[UIHint(UIHint.Variable)]
public FsmString fileName;


public override void Reset()
{
folderName = null;
fileIndex = 0;
fileName = null;

}

public override void OnEnter()
{
DoGetFileName();
Finish();
}


void DoGetFileName()
{
Object[] resourceDir = Resources.LoadAll(folderName.Value);
fileName.Value = resourceDir[fileIndex.Value].name;
}

}
}

4
Share New Actions / Get File Count
« on: February 12, 2013, 09:49:53 PM »
This script returns the number of files in a Resource Folder. Fields are:

  • Folder Name: enter the path where files are located inside the Resources directory. Leave this field empty to get all files in the Resource folder. Example usage: Folder 1/Subfolder 1
  • File Count: returns the number of files in the specified directory.

Resources
-file 1
-file 2
-Folder 1
--file 1
--file 2
--Subfolder 1
---file 1

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2012. All rights reserved.

using UnityEngine;
using System.Collections;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Files")]
[Tooltip("Get the number of files in a resource directory.")]
public class GetFileCount : FsmStateAction
{

[Tooltip("The name of the folder.")]
public FsmString folderName;

[Tooltip("The number of files in the folder")]
[UIHint(UIHint.Variable)]
public FsmInt fileCount;


public override void Reset()
{
folderName = null;
fileCount = 0;
}

public override void OnEnter()
{
DoGetFileCount();

Finish();
}


void DoGetFileCount()
{
Object[] resourceDir = Resources.LoadAll(folderName.Value);
fileCount.Value = resourceDir.Length;
}

}
}

5
Feature Requests / Color-code input and output fields
« on: February 12, 2013, 07:16:28 PM »
One part of PlayMaker that gets confusing to me is knowing when a field is for input or output. It would be nice if there was a way for the person who is scripting an action to color-code certain text so that users will know which fields generate a result, and which fields are the result.

I know that some people might want to turn this feature on or off, so maybe if there was an option to to turn color-coding on or off?

For example, the following action is straight forward, but only because the author followed strict naming conventions:

FSM State Test (current)
-Game Object
-Fsm Name
-State Name
-True Event
-False Event
-Store Result

FSM State Test (alternative. red=input, blue=output)
-Game Object
-State Name
-State Name
-True Event
-False Event
-Result

6
Share New Actions / Follow Mouse[SOLVED]
« on: October 30, 2012, 12:46:27 PM »
The script in this post works for 2D games on X/Y axis. Jean has an answer for 3D games a few posts down.

Use this script to have an object on screen follow the mouse. You can:
-give the object an X & Y offset from the mouse
-determine if the object can go off the screen
-if object can't go off screen, provide a screen offset that determines how close the object can get to the edge of the screen.

This script was designed for in-game objects. If you need something for your GUI, I would check out Jean's script here: http://hutonggames.com/playmakerforum/index.php?topic=2090.0

Follow Mouse
Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Transform)]
[Tooltip("Have an object follow the mouse.")]
public class FollowMouse : FsmStateAction
{
[RequiredField]
public FsmOwnerDefault gameObject;

[Tooltip("Show the object a specific distance on the X axis, away from the mouse.")]
public FsmFloat offsetX;

[Tooltip("Show the object a specific distance on the X axis, away from the mouse.")]
public FsmFloat offsetY;

[Tooltip("Select this if you don't want the object to move off screen with the mouse.")]
public FsmBool keepOnScreen;

[Tooltip("This determines how close to the edge of the screen the object can get IF Keep On Screen is used.")]
public FsmFloat screenOffset;

private float screenHeight;
private float screenWidth;

public override void Reset()
{
gameObject = null;
offsetX = null;
offsetY = null;
keepOnScreen = true;
screenOffset = null;
}

public override void OnEnter()
{
GetScreenSize();
DoSetPosition();
}

public override void OnUpdate()
{
DoSetPosition();
}

void GetScreenSize()
{
screenHeight = Screen.height;
screenWidth = Screen.width;
}

void DoSetPosition()
{
if (Camera.main == null)
{
LogError("No MainCamera defined!");
Finish();
return;
}


var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null)
{
return;
}

// get screen position
var position = Vector3.zero;
position.x = Input.mousePosition.x + offsetX.Value;
position.y = Input.mousePosition.y + offsetY.Value;

// if you want to keep the object on screen, this keeps the objects inside the screen
if (keepOnScreen.Value)
{
var xleft = 0f + screenOffset.Value;
var xright = screenWidth - screenOffset.Value;
var ytop = 0f + screenOffset.Value;
var ybottom = screenHeight - screenOffset.Value;

if (position.x < xleft) position.x = xleft;

if (position.x > xright) position.x = xright;

if (position.y < ytop) position.y = ytop;

if (position.y > ybottom) position.y = ybottom;
}

// convert screen position to world position
position = Camera.main.ScreenToWorldPoint(position);
position.z = 0f;

// move game object to world position
go.transform.position = position;
}

}



}

7
Share New Actions / Get Screen Position / Set Screen Position
« on: October 29, 2012, 12:23:03 PM »
First script gets the position of a game object in world space and converts it to screen space. The second script sets an object at a position on the screen.

There are actions that already do this, but they require a combination of actions. This keeps things simple.

GetScreenPosition
Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Transform)]
[Tooltip("Gets the Position of a Game Object on the screen and stores it in Float Variables")]
public class GetScreenPosition : FsmStateAction
{
[RequiredField]
public FsmOwnerDefault gameObject;

[Tooltip("Store the screen X position in a Float Variable.")]
public FsmFloat screenX;

[Tooltip("Store the screen Y position in a Float Variable.")]
public FsmFloat screenY;

public bool everyFrame;

public override void Reset()
{
gameObject = null;
screenX = null;
screenY = null;
everyFrame = false;
}

public override void OnEnter()
{
DoGetPosition();

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

public override void OnUpdate()
{
DoGetPosition();
}

void DoGetPosition()
{
if (Camera.main == null)
{
LogError("No MainCamera defined!");
Finish();
return;
}


var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null)
{
return;
}

// store the world position
var position = go.transform.position;

// store the screen position
position = Camera.main.WorldToScreenPoint(position);
screenX.Value = position.x;
screenY.Value = position.y;
}


}
}


SetScreenPosition
Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Transform)]
[Tooltip("Converts the screen position of a Game Object into the world position.")]
public class SetScreenPosition : FsmStateAction
{
[RequiredField]
public FsmOwnerDefault gameObject;

[Tooltip("Enter the the vector 3 that has your screen coordinates. If you don't have this, set each coordinate below.")]
public FsmVector3 vector3Value;

[Tooltip("Enter the screen X position.")]
public FsmFloat screenX;

[Tooltip("Enter the screen Y position.")]
public FsmFloat screenY;

[Tooltip("Enter the world Z position.")]
public FsmFloat worldZ;

public bool everyFrame;

public override void Reset()
{
gameObject = null;
vector3Value = null;
screenX = null;
screenY = null;
worldZ = null;
everyFrame = false;
}

public override void OnEnter()
{
DoSetPosition();

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

public override void OnUpdate()
{
DoSetPosition();
}

void DoSetPosition()
{
if (Camera.main == null)
{
LogError("No MainCamera defined!");
Finish();
return;
}


var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null)
{
return;
}

var position = Vector3.zero;

// get the screen position
if (vector3Value == null)
{
position.x = screenX.Value;
position.y = screenY.Value;
}
else
{
position = vector3Value.Value;
}

// convert screen position to world position
position = Camera.main.ScreenToWorldPoint(position);
position.z = worldZ.Value;

// move game object to world position
go.transform.position = position;
}
}
}

8
Is there a way to call an action that isn't on a game object?

Here's my problem:
-I have 1000 creatures with different behaviors.
-1000 FSMs kills my game performance (even when disabled), so I believe I need to avoid them for the creatures.
-Having all 1000 creatures use the same FSM on a game monitor GO won't work because it's possible one creature will call the FSM before the FSM is finished for another creature.

Here's what I'm trying to do:
-I have an action called MorphCreature.
-I use this in an FSM on my game monitor GO.
-I'd like to use the same MorphCreature action in the C# script I've attached to each creature. Goal is not to duplicate code.

So if you had a non-FSM script and you wanted to reference an FSM action script, how would you do this?

Thanks for any help!

9
Share New Actions / String Multi Test
« on: October 05, 2012, 08:41:46 PM »
Compares a bunch of strings all at once. For example:

If (string1 = "hello" && string2 = "world")
{
   do this
}

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Logic)]
[Tooltip("Tests if all the given String Variables are are equal to thier String States.")]
public class StringTestMulti : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
[Tooltip("This must be the same number used for String States.")]
public FsmString[] stringVariables;

[RequiredField]
[Tooltip("This must be the same number used for String Variables.")]
public FsmString[] stringStates;

public FsmEvent trueEvent;
public FsmEvent falseEvent;

[UIHint(UIHint.Variable)]
public FsmBool storeResult;

public bool everyFrame;

public override void Reset()
{
stringVariables = null;
stringStates = null;
trueEvent = null;
falseEvent = null;
storeResult = null;
everyFrame = false;
}

public override void OnEnter()
{
DoAllTrue();

if (!everyFrame)
Finish();
}

public override void OnUpdate()
{
DoAllTrue();
}

void DoAllTrue()
{
if (stringVariables.Length == 0 || stringStates.Length == 0) return;
if (stringVariables.Length != stringStates.Length) return;

bool allTrue = true;

for (int i = 0; i < stringVariables.Length; i++)
{
if (stringVariables[i].Value != stringStates[i].Value)
{
allTrue = false;
break;
}
}

storeResult.Value = allTrue;

if (allTrue)
Fsm.Event(trueEvent);
else
Fsm.Event (falseEvent);
}
}
}

10
Share New Actions / Integer Multi Test
« on: October 05, 2012, 08:08:52 PM »
Just like Bool Multi Test. In this action, you can compare several integers at once. For example:

If (a=3 && b=-1 && c = 120)
{
    do this
}

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Logic)]
[Tooltip("Tests if all the given Integer Variables are are equal to thier Integer States.")]
public class IntTestMulti : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
[Tooltip("This must be the same number used for Integer States.")]
public FsmInt[] intVariables;

[RequiredField]
[Tooltip("This must be the same number used for Integer Variables.")]
public FsmInt[] intStates;

public FsmEvent trueEvent;
public FsmEvent falseEvent;

[UIHint(UIHint.Variable)]
public FsmBool storeResult;

public bool everyFrame;

public override void Reset()
{
intVariables = null;
intStates = null;
trueEvent = null;
falseEvent = null;
storeResult = null;
everyFrame = false;
}

public override void OnEnter()
{
DoAllTrue();

if (!everyFrame)
Finish();
}

public override void OnUpdate()
{
DoAllTrue();
}

void DoAllTrue()
{
if (intVariables.Length == 0 || intStates.Length == 0) return;
if (intVariables.Length != intStates.Length) return;

bool allTrue = true;

for (int i = 0; i < intVariables.Length; i++)
{
if (intVariables[i].Value != intStates[i].Value)
{
allTrue = false;
break;
}
}

storeResult.Value = allTrue;

if (allTrue)
Fsm.Event(trueEvent);
else
Fsm.Event (falseEvent);
}
}
}

11
Share New Actions / Bool Multi Test[SOLVED]
« on: October 05, 2012, 01:09:20 PM »
The following action can take several bools with different values and compare them all at once. It's the equivalent to this:

If (bool1 == true && bool2 == false && bool3 == false & bool4 == true)
{
   do this
}

To use it, do this:
(a) enter the number of bools to include in the statement in the Bool Variables field.
(b) enter the exact same number in the Bool States field.
(c) in Bool Variable (0) field, enter the variable with the bool.
(d) in Bool State (0) field, enter the state that the bool variable must be for this action to return True.
(e) repeat c & d for each additional variable that you add.

To get TRUE:
All bools variables must match the bool states that you selected.

To get FALSE:
If any bool variable does not match it's bool state.

The code:
Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Logic)]
[Tooltip("Tests if all the given Bool Variables are are equal to thier Bool States.")]
public class BoolTestMulti : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
[Tooltip("This must be the same number used for Bool States.")]
public FsmBool[] boolVariables;

[RequiredField]
[Tooltip("This must be the same number used for Bool Variables.")]
public FsmBool[] boolStates;

public FsmEvent trueEvent;
public FsmEvent falseEvent;

[UIHint(UIHint.Variable)]
public FsmBool storeResult;

public bool everyFrame;

public override void Reset()
{
boolVariables = null;
boolStates = null;
trueEvent = null;
falseEvent = null;
storeResult = null;
everyFrame = false;
}

public override void OnEnter()
{
DoAllTrue();

if (!everyFrame)
Finish();
}

public override void OnUpdate()
{
DoAllTrue();
}

void DoAllTrue()
{
if (boolVariables.Length == 0 || boolStates.Length == 0) return;
if (boolVariables.Length != boolStates.Length) return;

bool allTrue = true;

for (int i = 0; i < boolVariables.Length; i++)
{
if (boolVariables[i].Value != boolStates[i].Value)
{
allTrue = false;
break;
}
}

storeResult.Value = allTrue;

if (allTrue)
Fsm.Event(trueEvent);
else
Fsm.Event (falseEvent);
}
}
}

In the image below, if B: Flag Right Wall is TRUE, and B: Flag Bottom Wall is FALSE, the stored result will be TRUE and the True Event is called.

12
Share New Actions / Set Camera Background Color
« on: September 28, 2012, 06:26:47 PM »
This is handy if you have a day and night system. I use this with the Ease Color action to change my sky.

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2012. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Camera)]
[Tooltip("Set the background color of a camera")]
public class SetCameraBackgroundColor : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(Camera))]
[Tooltip("The camera.")]
public FsmOwnerDefault camera;

[RequiredField]
[Tooltip("Background color")]
public FsmColor color;

[Tooltip("Repeat every frame.")]
public bool everyFrame;

private Camera cam;

public override void Reset()
{
camera = null;
color = null;

}

public override void OnEnter()
{
var go = Fsm.GetOwnerDefaultTarget(camera);
if (go == null)
{
return;
}

cam = go.camera;
if (cam==null)
{
return;

}

DoSetColor();

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

public override void OnUpdate()
{
DoSetColor();
}

void DoSetColor()
{
cam.backgroundColor = color.Value;
}

}
}

This script is based on Jean's CameraSetOrthographicSize.

13
Playmaker Help / How to access camera properties?
« on: September 28, 2012, 04:56:39 PM »
I have a camera with a few properties I want to tweak, but I'm not sure how to do this. I tried saving the camera component as an object variable, but I don't see the camera in the object list. I'm not sure how to get the camera properties.

A few of the camera properties that I'm trying to access are:
-Clear Flags
-Background
-Culling Mask

Any ideas?

14
Playmaker Help / set Target FSM via script (UIEventsToPlaymakerFSM)[SOLVED]
« on: September 28, 2012, 11:11:24 AM »
I've run into a situation where I need to set the Target FSM field in the UIEventsToPlaymakerFSM, using a NGUI script called UIPopupList.

I'm not sure how to get pmEvents.targetFSM to get the game object that has the FSM. I tried using this code to reference the game object, but I get a conversion error, since targetFSM is looking for an FSM component:
var otherGameObject = GameObject.Find("Other");

Anyone know a solution? I'm trying to reference a game object in the Hierarchy called Monitor that contains an FSM called Click.

Code: [Select]
UIEventsToPlaymakerFSM pmEvents = UIEventsToPlaymakerFSM.Get(lbl.gameObject); //works
pmEvents.onClickEvent = "Item Clicked";  //works
pmEvents.targetFSM = //What goes here?

15
This is for 2D games that want to have many layers of backgrounds that move at different speeds. To use this, you must have a camera for each background. The cameras move, not the scene. A lot less moving parts.

Here is how you would use this with a foreground and background:

1. In Hierarchy, create this folder structure:

Cameras (empty game object)
--Background (empty game object)
-----Camera (contains your ortho camera for background)
--Foreground (empty game object)
-----Camera (contains your ortho camera for foreground)

2. Camera Depth: make sure that each camera is using a different depth.

3. Culling Mask: make sure that each camera only includes the layers it should draw on screen.

4. Clear Flags: make sure that the foreground camera has this set to Depth Only. If a solid color is used, you won't see the background.

5. Use the SetCameraPosition action like this:
  • Game Object: Set this to the camera's container. For example, Background or Foreground. (don't attach to camera inside)
  • X, Y, Z: Set this to the coordinates of your primary camera container. (probably your foreground)
  • Speed X, Speed Y, Speed Z: Enter how fast you want the camera to move, related to how fast the primary camera is moving. 0 = no movement, <1 = slower speed, 1 = same speed, >1 = faster speed,  

Note: I use FingerGesturesDragCamera to move my primary camera (Foreground). I only use the above action for my secondary cameras.  http://hutonggames.com/playmakerforum/index.php?topic=1553.0

SetCameraPosition.cs code:
Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Transform)]
[Tooltip("Sets the Position of a Game Object. To leave any axis unchanged, set variable to 'None'.")]
public class SetCameraPosition : FsmStateAction
{
[RequiredField]
[Tooltip("The parent game object that contains the child camera game object.")]
public FsmOwnerDefault gameObject;

[UIHint(UIHint.Variable)]
[Tooltip("Set individual axis below.")]
public FsmFloat x;
public FsmFloat y;
public FsmFloat z;

[Tooltip("How fast do you want the camera to move?")]
public FsmFloat speedX;
public FsmFloat speedY;
public FsmFloat speedZ;

[Tooltip("Use local or world space.")]
public Space space;

[Tooltip("Repeat every frame.")]
public bool everyFrame;

[Tooltip("Perform in LateUpdate. This is useful if you want to override the position of objects that are animated or otherwise positioned in Update.")]
public bool lateUpdate;

public override void Reset()
{
gameObject = null;

// default axis to variable dropdown with None selected.
x = new FsmFloat { UseVariable = true };
y = new FsmFloat { UseVariable = true };
z = new FsmFloat { UseVariable = true };

speedX = null;
speedY = null;
speedZ = null;

space = Space.Self;
everyFrame = false;
lateUpdate = false;
}

public override void OnEnter()
{
if (!everyFrame && !lateUpdate)
{
DoSetPosition();
Finish();
}
}

public override void OnUpdate()
{
if (!lateUpdate)
{
DoSetPosition();
}
}

public override void OnLateUpdate()
{
if (lateUpdate)
{
DoSetPosition();
}

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

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

Vector3 position;
position = space == Space.World ? go.transform.position : go.transform.localPosition;

// override any axis

if (!x.IsNone) position.x = x.Value * speedX.Value;
if (!y.IsNone) position.y = y.Value * speedY.Value;
if (!z.IsNone) position.z = z.Value * speedZ.Value;

// apply

if (space == Space.World)
{
go.transform.position = position;
}
else
{
go.transform.localPosition = position;
}
}


}
}

Pages: [1] 2 3