using UnityEngine; using System.Collections; namespace Forces { public enum ForceMode { Force, Impulse, Aceleration } /// /// Label force static information /// [System.Serializable] public struct ForceProps { /// /// indetify instance id /// public string Name; /// /// inertia value when starts in seconds (fade in) /// public float inertia_in; /// /// inertia value when ends in seconds (fade out) /// public float inertia_out; /// /// time calling without Update /// public float impulse; /// /// goal speed /// public float target_speed; /// /// mode of applying this force /// public ForceMode forceMode; public ForceProps(string Name, float target_speed, float inertia_in = 1.0f, float inertia_out = 1.0f, float impulse = 0.0f) { this.Name = Name; this.target_speed = target_speed; this.inertia_in = inertia_in; this.inertia_out = inertia_out; this.impulse = impulse; this.forceMode = impulse > 0.0f ? ForceMode.Impulse : ForceMode.Force; } } /// /// Target force and new vector to apply /// public struct Force2Call { public Vector3 direction; public Force force; public Force2Call(Vector3 direction, Force force) { this.direction = direction; this.force = force; } } }