objc2_gameplay_kit/generated/
GKGoal.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// Defines a spatial directive.
12    /// The various goals cause force to be applied to agents to try to achieve said goal.
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkgoal?language=objc)
15    #[unsafe(super(NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct GKGoal;
18);
19
20extern_conformance!(
21    unsafe impl NSCopying for GKGoal {}
22);
23
24unsafe impl CopyingHelper for GKGoal {
25    type Result = Self;
26}
27
28extern_conformance!(
29    unsafe impl NSObjectProtocol for GKGoal {}
30);
31
32impl GKGoal {
33    extern_methods!(
34        #[cfg(all(feature = "GKAgent", feature = "GKComponent"))]
35        /// Creates a goal to move toward the agent
36        ///
37        /// Parameter `agent`: the agent to seek
38        #[unsafe(method(goalToSeekAgent:))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn goalToSeekAgent(agent: &GKAgent) -> Retained<Self>;
41
42        #[cfg(all(feature = "GKAgent", feature = "GKComponent"))]
43        /// Creates a goal to move away from the agent
44        ///
45        /// Parameter `agent`: the agent to flee from
46        #[unsafe(method(goalToFleeAgent:))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn goalToFleeAgent(agent: &GKAgent) -> Retained<Self>;
49
50        #[cfg(feature = "GKObstacle")]
51        /// Creates a goal to avoid colliding with a group of agents without taking into account those agents' momentum
52        ///
53        /// Parameter `maxPredictionTime`: how far ahead in the future, in seconds, should we look for potential collisions
54        #[unsafe(method(goalToAvoidObstacles:maxPredictionTime:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn goalToAvoidObstacles_maxPredictionTime(
57            obstacles: &NSArray<GKObstacle>,
58            max_prediction_time: NSTimeInterval,
59        ) -> Retained<Self>;
60
61        #[cfg(all(feature = "GKAgent", feature = "GKComponent"))]
62        /// Creates a goal to avoid colliding with a group of agents taking into account those agent's momentum
63        ///
64        /// Parameter `maxPredictionTime`: how far ahead in the future, in seconds, should we look for potential collisions
65        #[unsafe(method(goalToAvoidAgents:maxPredictionTime:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn goalToAvoidAgents_maxPredictionTime(
68            agents: &NSArray<GKAgent>,
69            max_prediction_time: NSTimeInterval,
70        ) -> Retained<Self>;
71
72        #[cfg(all(feature = "GKAgent", feature = "GKComponent"))]
73        /// Creates a goal that tries to repel this agent away from the other agents and attempts to prevent overlap
74        ///
75        /// Parameter `maxDistance`: the distance between agents before repelling happens
76        ///
77        /// Parameter `maxAngle`: the angle, in radians, between this agent's foward and the vector toward the other agent before the repelling happens
78        #[unsafe(method(goalToSeparateFromAgents:maxDistance:maxAngle:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn goalToSeparateFromAgents_maxDistance_maxAngle(
81            agents: &NSArray<GKAgent>,
82            max_distance: c_float,
83            max_angle: c_float,
84        ) -> Retained<Self>;
85
86        #[cfg(all(feature = "GKAgent", feature = "GKComponent"))]
87        /// Creates a goal to align this agent's orientation with the average orientation of the group of agents.
88        ///
89        /// Parameter `maxDistance`: the distance between agents before alignment happens
90        ///
91        /// Parameter `maxAngle`: the angle, in radians, between this agent's foward and the vector toward the other agent before alignment happens
92        #[unsafe(method(goalToAlignWithAgents:maxDistance:maxAngle:))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn goalToAlignWithAgents_maxDistance_maxAngle(
95            agents: &NSArray<GKAgent>,
96            max_distance: c_float,
97            max_angle: c_float,
98        ) -> Retained<Self>;
99
100        #[cfg(all(feature = "GKAgent", feature = "GKComponent"))]
101        /// Creates a goal to seek the average position of the group of agents.
102        ///
103        /// Parameter `maxDistance`: the distance between agents before cohesion happens
104        ///
105        /// Parameter `maxAngle`: the angle between this agent's foward and the vector toward the other agent before cohesion happens
106        #[unsafe(method(goalToCohereWithAgents:maxDistance:maxAngle:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn goalToCohereWithAgents_maxDistance_maxAngle(
109            agents: &NSArray<GKAgent>,
110            max_distance: c_float,
111            max_angle: c_float,
112        ) -> Retained<Self>;
113
114        /// Creates a goal that attempts to change our momentum to reach the target speed
115        ///
116        /// Parameter `targetSpeed`: the target speed
117        #[unsafe(method(goalToReachTargetSpeed:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn goalToReachTargetSpeed(target_speed: c_float) -> Retained<Self>;
120
121        /// Creates a goal that will make the agent appear to wander, aimlessly moving forward and turning randomly
122        ///
123        /// Parameter `speed`: the speed at which to wander
124        #[unsafe(method(goalToWander:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn goalToWander(speed: c_float) -> Retained<Self>;
127
128        #[cfg(all(feature = "GKAgent", feature = "GKComponent"))]
129        /// Creates a goal that will attempt to intercept another target agent taking into account that agent's momentum
130        ///
131        /// Parameter `target`: agent to intercept
132        ///
133        /// Parameter `maxPredictionTime`: how far ahead in the future, in seconds, should we look for potential intercepts
134        #[unsafe(method(goalToInterceptAgent:maxPredictionTime:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn goalToInterceptAgent_maxPredictionTime(
137            target: &GKAgent,
138            max_prediction_time: NSTimeInterval,
139        ) -> Retained<Self>;
140
141        #[cfg(feature = "GKPath")]
142        /// Creates a goal that will attempt to follow the given path
143        ///
144        /// Parameter `path`: the path to follow
145        ///
146        /// Parameter `maxPredictionTime`: how far ahead in the future, in seconds, should we look for potential intercepts
147        ///
148        /// Parameter `forward`: direction to follow the path. forward = NO is reverse
149        #[unsafe(method(goalToFollowPath:maxPredictionTime:forward:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn goalToFollowPath_maxPredictionTime_forward(
152            path: &GKPath,
153            max_prediction_time: NSTimeInterval,
154            forward: bool,
155        ) -> Retained<Self>;
156
157        #[cfg(feature = "GKPath")]
158        /// Creates a goal that will attempt to stay on the given path
159        ///
160        /// Parameter `path`: the path to follow
161        ///
162        /// Parameter `maxPredictionTime`: how far ahead in the future, in seconds, should we look for potential intercepts
163        #[unsafe(method(goalToStayOnPath:maxPredictionTime:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn goalToStayOnPath_maxPredictionTime(
166            path: &GKPath,
167            max_prediction_time: NSTimeInterval,
168        ) -> Retained<Self>;
169    );
170}
171
172/// Methods declared on superclass `NSObject`.
173impl GKGoal {
174    extern_methods!(
175        #[unsafe(method(init))]
176        #[unsafe(method_family = init)]
177        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
178
179        #[unsafe(method(new))]
180        #[unsafe(method_family = new)]
181        pub unsafe fn new() -> Retained<Self>;
182    );
183}