com.badlogic.gdx.ai.steer.proximities.ProximityBase Maven / Gradle / Ivy
/*******************************************************************************
* Copyright 2014 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.ai.steer.proximities;
import com.badlogic.gdx.ai.steer.Proximity;
import com.badlogic.gdx.ai.steer.Steerable;
import org.mini2Dx.gdx.math.Vector;
/** {@code ProximityBase} is the base class for any concrete proximity based on an iterable collection of agents.
*
* @param Type of vector, either 2D or 3D, implementing the {@link Vector} interface
*
* @author davebaol */
public abstract class ProximityBase> implements Proximity {
/** The owner of this proximity. */
protected Steerable owner;
/** The collection of the agents handled by this proximity.
*
* Note that, being this field of type {@code Iterable}, you can either use java or libgdx collections. See
* https://github.com/libgdx/gdx-ai/issues/65 */
protected Iterable extends Steerable> agents;
/** Creates a {@code ProximityBase} for the specified owner and list of agents.
* @param owner the owner of this proximity
* @param agents the list of agents */
public ProximityBase (Steerable owner, Iterable extends Steerable> agents) {
this.owner = owner;
this.agents = agents;
}
@Override
public Steerable getOwner () {
return owner;
}
@Override
public void setOwner (Steerable owner) {
this.owner = owner;
}
/** Returns the the agents that represent potential neighbors. */
public Iterable extends Steerable> getAgents () {
return agents;
}
/** Sets the agents that represent potential neighbors. */
public void setAgents (Iterable> agents) {
this.agents = agents;
}
}