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

# Tyrion.AI_EnterVehicleGoal

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

    //=====================================================================
    // AI_EnterVehicleGoal
    //=====================================================================

    class AI_EnterVehicleGoal extends AI_MovementGoal
    	editinlinenew;

    //=====================================================================
    // Variables

    var(Parameters) editinline Name vehicleOrTurretName "Name of vehicle or turret to enter";
    var(Parameters) Vehicle.VehiclePositionType vehiclePosition "Preferred vehicle position to enter; if position is taken AI will enter any free position";
    var(Parameters) float energyUsage;

    var(InternalParameters) editconst Pawn vehicleOrTurret;

    //=====================================================================
    // Functions

    overloaded function construct( AI_Resource r, int pri, Pawn _vehicleOrTurret, Vehicle.VehiclePositionType _vehiclePosition,
    							  optional float _energyUsage )
    {
    	priority = pri;
    	vehicleOrTurret = _vehicleOrTurret;
    	vehiclePosition = _vehiclePosition;
    	energyUsage = _energyUsage;

    	super.construct( r );
    }

    //---------------------------------------------------------------------
    // Called explicitly at start of gameplay

    function init( AI_Resource r )
    {
    	super.init( r );

    	if ( vehicleOrTurret == None && vehicleOrTurretName != '' )
    		vehicleOrTurret = Pawn(resource.pawn().findByLabel( class'Pawn', vehicleOrTurretName, true ));

    	if ( vehicleOrTurret == None )
    	{
    		log( "AI WARNING:" @ name @ "can't find specified pawn" @ vehicleOrTurretName );

    		// goal needs to be matched so it can be cleaned up by the action:
    		bInActive = false;
    	}
    	else
    	{
    		// userData is always 'None' for deactivation sensors, and != None for activation sensors
    		activationSentinel.activateSentinel( self, class'AI_EnterVehicleSensor', characterResource(),, class'AI_Sensor'.const.ONLY_NON_NONE_VALUE, self );
    		AI_EnterVehicleSensor(activationSentinel.sensor).setParameters( vehicleOrTurret, vehiclePosition );
    	}
    }

    //---------------------------------------------------------------------
    // Setup deactivation sentinel

    function setUpDeactivationSentinel()
    {
    	deactivationSentinel.activateSentinel( self, class'AI_EnterVehicleSensor', characterResource(),, class'AI_Sensor'.const.ONLY_NONE_VALUE, None );
    }

    //=====================================================================

    defaultproperties
    {
    	bInactive = true
    	bPermanent = true	// goal is made non-permanent if it succeeds
    }

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

Class file time: ne 5.9.2004 15:54:26.000 - Creation time: st 23.5.2018 00:10:41.137 - Created with UnCodeX