// Copyright (C) 2023 Nicholas Maltbie
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
// associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using UnityEngine;
namespace nickmaltbie.OpenKCC.Environment.MovingGround
{
///
/// Moving ground object that a player can move along with
///
public interface IMovingGround
{
///
/// Get the velocity (in units per second) that the object is moving
/// at a given point on the surface of the object (in world space).
///
/// Point on the surface of the object (in world space).
/// Velocity that the object is moving at the point.
Vector3 GetVelocityAtPoint(Vector3 point);
///
/// Get the weight of movement for a given player's velocity at a given point.
///
/// Point where player is standing on the object.
/// Velocity of the player.
/// Weight of player's attachment to the object given these
/// parameters. Will be between 0 (not attached at all) and 1 (fully attached).
float GetMovementWeight(Vector3 point, Vector3 playerVelocity);
///
/// Get the weight of movement of transfering momentum when a player leaves this object
///
/// Point where player is standing on the object.
/// Velocity of the player.
/// How much relative velocity teh player should retain when departing from the surface of this object
/// via jump or fall.
float GetTransferMomentumWeight(Vector3 point, Vector3 playerVelocity);
///
/// Should momentum be transferred to players when they
/// leave this object.
///
bool AvoidTransferMomentum();
///
/// When following this object, should the player attach themselves
/// to the object to follow it properly? This is important
/// for rapidly moving objects. Additionally, if the object does
/// not move but wants to push the player (such as a conveyer belt),
/// then players should definitely not attach to the object.
///
bool ShouldAttach();
}
}