Hi
I am making my C# script into a playmaker script so i can add it to the Ecosystem once tested. But i've not used GameObject references to FSM owner before and I have followed guides and looked at other script to see if i can resolve but i'm stuck with the following errors.
Error 1
Assets/PlayMaker Custom Actions/Time/MovingPlatformTest.cs(63,70): error CS1061: Type `HutongGames.PlayMaker.FsmOwnerDefault' does not contain a definition for `position' and no extension method `position' of type `HutongGames.PlayMaker.FsmOwnerDefault' could be found (are you missing a using directive or an assembly reference?)
Error 2
Assets/PlayMaker Custom Actions/Time/MovingPlatformTest.cs(66,42): error CS0019: Operator `+' cannot be applied to operands of type `float' and `HutongGames.PlayMaker.FsmFloat'
// (c) Copyright HutongGames, LLC 2010-2015. All rights reserved.
// Action made by NickCoxMedia
// __ECO__ __PLAYMAKER__ __ACTION__
using UnityEngine;
using System.Collections;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Transform)]
[Tooltip("This will transform a object from one position to another")]
public class MovingPlatform : FsmStateAction
{
public FsmOwnerDefault gameObject; //owner
[RequiredField]
[Tooltip("How fast the platform moves")]
public FsmFloat Speed; //speed
[Tooltip("Choose a destination spot")]
public FsmOwnerDefault DestinationSpot;
[Tooltip("Choose a starting spot")]
public FsmOwnerDefault OriginSpot;
[Tooltip("shows when the platform returns")]
public FsmBool Switch = false;
[Tooltip("How long to delay before moving")]
public FsmFloat delayBeforeMoving;
private float pauseTime;
private bool arrivedAtOurDestination = false;
public override void Reset()
{
DestinationSpot = null;
OriginSpot = null;
Switch = false;
delayBeforeMoving = null;
gameObject = null; //owner null
}
public override void OnFixedUpdate()
{
DoMovingPlatform();
}
void DoMovingPlatform()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if(go == null) return;
// For these 2 if statements, it's checking the position of the platform.
// If it's at the destination spot, it sets Switch to true.
if((go.transform.position == DestinationSpot.position) && !arrivedAtOurDestination)
{
Switch = true;
pauseTime = Time.time + delayBeforeMoving;
arrivedAtOurDestination = true;
}
}
}
}