/// <summary> /// Internal method which registers the kinematic object that should be managed by the KinematicObjectManager. /// </summary> /// <param name="kinematicObject">The kinematic object that should be managed by the KinematicObjectManager.</param> /// <returns>The index of the kinematci object registered.</returns> private int RegisterKinematicObjectInternal(IKinematicObject kinematicObject) { if (m_KinematicObjectCount == m_KinematicObjects.Length) { System.Array.Resize(ref m_KinematicObjects, m_KinematicObjects.Length + 1); Debug.LogWarning($"Kinematic objects array resized. For best performance increase the size of the Start Kinematic Object Count variable " + $"within the Kinematic Object Manager to a value of at least {(m_KinematicObjectCount + 1)}."); } m_KinematicObjects[m_KinematicObjectCount] = GenericObjectPool.Get <KinematicObject>(); m_KinematicObjects[m_KinematicObjectCount].Initialize(kinematicObject); m_KinematicObjectCount++; return(m_KinematicObjectCount - 1); }
/// <summary> /// Registers the kinematic object that should be managed by the KinematicObjectManager. /// </summary> /// <param name="kinematicObject">The kinematic object that should be managed by the KinematicObjectManager.</param> /// <returns>The index of the kinematci object registered.</returns> public static int RegisterKinematicObject(IKinematicObject kinematicObject) { return(Instance.RegisterKinematicObjectInternal(kinematicObject)); }
/// <summary> /// Initializes the object. /// </summary> /// <param name="kinematicObject">The kinematic object that is being managed by the KinematicObjectManager.</param> public void Initialize(IKinematicObject kinematicObject) { m_KinematicObject = kinematicObject; Initialize(m_KinematicObject.transform); }