Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

# MojoActions.TsActionMoveTo

00001 00002 00003 00004 00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094

    class TsActionMoveTo extends TsPawnAction;

    var(Action) MojoKeyframe target;
    var(Action) enum EViewFocusType
    {
    	VIEW_FOCUS_Actor,
    	VIEW_FOCUS_Point,
    	VIEW_FOCUS_None
    } viewFocusType;
    var(Action) MojoActorRef viewFocusActor;
    var(Action) MojoKeyframe viewFocusPoint;
    var(Action) enum EMoveType
    {
    	MOVE_TYPE_Run,
    	MOVE_TYPE_Walk,
    } move_type;

    var transient TsMojoController MojoController;

    function bool OnStart()
    {
    	local bool shouldWalk;
    	local vector viewFcsPntPstn;
    	local bool nullViewFcsPntPstn;

    	// do move type specific action
    	switch(move_type)
    	{
    	case MOVE_TYPE_Run:
    		shouldWalk = false;
    		break;

    	case MOVE_TYPE_Walk:
    		shouldWalk = true;
    		break;
    	}

    	MojoController = TsMojoController(Pawn.Controller);
    	if (MojoController == None)
    	{
    		Log("TsActionMoveTo, failed to find MojoController");
    		return false;
    	}

    	viewFocusActor.actor = None;

    	// get specifed view focus
    	switch (viewFocusType)
    	{
    	case VIEW_FOCUS_Actor:
    		nullViewFcsPntPstn = true;

    		viewFocusActor = ResolveActorRef(viewFocusActor);
    		if (viewFocusActor.actor == None)
    			Log("TsActionMoveTo, Failed to find view focus actor "$viewFocusActor.name);

    		break;

    	case VIEW_FOCUS_Point:
    		viewFcsPntPstn = viewFocusPoint.position;
    		nullViewFcsPntPstn = false;
    		break;

    	case VIEW_FOCUS_None:
    		nullViewFcsPntPstn = true;
    		break;
    	}

    	// put mojo controller in appropriate move state
    	MojoController.BeginMoveToPoint(target.position, target.rotation, viewFocusActor.actor, viewFcsPntPstn,
    			nullViewFcsPntPstn, shouldWalk);

    	return true;
    }

    function bool OnTick(float delta)
    {
    	return !MojoController.FinishedState();
    }

    function OnFinish()
    {
    	Log("Finished Move To");
    }

    defaultproperties
    {
    	DName			="Move To"
    	Track			="Position"
    	Help			="Move to a vector location"
    	ModifiesLocation = true

    	viewFocusType	=VIEW_FOCUS_None
    }

Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

Class file time: ne 5.9.2004 15:53:36.000 - Creation time: st 23.5.2018 00:10:49.326 - Created with UnCodeX