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

# Tyrion.AI_GunnerGoal

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_GunnerGoal
    // Goals for the Gunner Resource
    //=====================================================================

    class AI_GunnerGoal extends AI_Goal
    	abstract;

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

    var(Parameters) Vehicle.VehiclePositionType position;

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

    //---------------------------------------------------------------------
    // Accessor function for resource

    function AI_VehicleResource vehicleResource()
    {
    	local Turret turret;
    	local Vehicle vehicle;

    	turret = Turret(AI_GunnerResource(resource).m_pawn);
    	vehicle = Vehicle(AI_GunnerResource(resource).m_pawn);

    	if ( turret != None )
    		return AI_VehicleResource(turret.vehicleAI);

    	if ( vehicle != None )
    		return AI_VehicleResource(vehicle.vehicleAI);

    	return None;
    }

    //---------------------------------------------------------------------
    // Return the resource class for this goal

    static function class<Tyrion_ResourceBase> getResourceClass()
    {
    	return class'AI_GunnerResource';
    }

    //---------------------------------------------------------------------
    // Depending on the type of goal, find the resource the goal should be
    // attached to (if you happen to have an instance of the goal pass it in)

    static function Tyrion_ResourceBase findResource( Pawn p, optional Tyrion_GoalBase goal )
    {
    	local Vehicle vehicle;
    	local Turret turret;

    	vehicle = Vehicle(p);
    	turret = Turret(p);

    	if ( vehicle != None && goal != None )
    	{
    		// There's no way of identifying gunner resources uniquely with just the pawn - so return None if no
    		// goal instance is specified.
    		// (Vehicles get their goals attached to every position in InitVehicleAI() anyway)
    		return vehicle.positions[vehicle.getPositionIndex( AI_GunnerGoal(goal).position )].toBePossessed.mountAI;
    	}

    	if ( turret != None )
    		return turret.mountAI;

    	return 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:54:16.000 - Creation time: st 23.5.2018 00:10:41.326 - Created with UnCodeX