Been at this for hours now and finally decided to see if I could get some help. I simply want to move an object from point A to point B. No problem got that. Once the gameobject is there i want it to play its animation. Problem. It has two animations. Idle and working. Once it gets to point B it’s supposed to start animating but nothing. It’s using simple Legacy animations and they work fine until i try to start them in script. Any help would be appreciated.
//Inspector variables
public var costToBuild :float; //cost to build the rig
public var timeToBuild :float; //time it takes rig to be built
public var upTime :int; //amount of time rig has operated
public var maintCost :float; //daily cost to maintain rig properly
public var safetyRating :int; //overall safety rating of the rig. Affects every aspect of the rig
public var epaImpact :int; //Impact rig has on enviroment
public var contractLength :int; //Current length of this rigs contract
public var personsOnboard :int; //How many people are employed and work on the rig
public var basePay :int; //base payment of each crew member on board
public var workDesire :int; //This is the overall desire of the rig which affects personnal willing to work on the rig
public var totalOccupy :int; //Complete occupants
public var drillingSpeed :int; //How fast a rig drills each day
public var generation :int; //1st generation to 6th
public var totalCost :float; //Total daily cost to run rig. Base cost
public var rigType :int; //1:platform /2:jackup /3:floater /4:semi /5:drillship
//Private variables
var isWorking :boolean = false; //switch for animations based on rig working or not
var bMove :boolean = false;
//Game Loop
function Update ()
{
var wellMoveTo : Transform = GameObject.Find("shallowwell_02").transform;
var Distance : Vector3 = wellMoveTo.transform.position - transform.position;
if(isWorking == false)
{
animation.Play("platform_Idle", PlayMode.StopAll);
}
//Movement code for rigs
var startPos :Vector3 = gameObject.transform.position;
var endPos :Vector3 = wellMoveTo.transform.position;
var dist = Vector3.Distance(transform.position, wellMoveTo.position);
if(bMove == true)
{
transform.position = Vector3.Lerp(transform.position, wellMoveTo.transform.position, Time.deltaTime * 1.0);
print ("Distance to other: " + dist);
if (dist < 2.0)
{
print("should be working");
animation.Play("platform_Working", PlayMode.StopAll);
isWorking = true;
bMove = false;
}
}
}