implementation of drecon in unity 2022 lts
forked from:
https://github.com/joanllobera/marathon-envs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.6 KiB
69 lines
1.6 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Pool;
|
|
|
|
public class Body : MonoBehaviour
|
|
{
|
|
private ObjectPool<Body> m_Pool;
|
|
public Transform m_Pelvis;
|
|
public int m_DespawnTimer;
|
|
|
|
public bool m_JDActive;
|
|
|
|
[Header("Body Parts")]
|
|
public Transform m_Head;
|
|
public Transform m_Spine;
|
|
public Transform m_Left_Thigh;
|
|
public Transform m_Left_Leg;
|
|
public Transform m_Left_Foot;
|
|
public Transform m_Right_Thigh;
|
|
public Transform m_Right_Leg;
|
|
public Transform m_Right_Foot;
|
|
public Transform m_Left_Arm;
|
|
public Transform m_Left_Forearm;
|
|
public Transform m_Right_Arm;
|
|
public Transform m_Right_Forearm;
|
|
|
|
|
|
private JointDriveController m_JDController;
|
|
|
|
private void OnEnable()
|
|
{
|
|
if(m_JDController == null && m_JDActive) {
|
|
m_JDController = this.GetComponent<JointDriveController>();
|
|
|
|
m_JDController.SetupBodyPart(m_Head);
|
|
m_JDController.SetupBodyPart(m_Spine);
|
|
|
|
m_JDController.SetupBodyPart(m_Left_Thigh);
|
|
m_JDController.SetupBodyPart(m_Left_Leg);
|
|
m_JDController.SetupBodyPart(m_Left_Foot);
|
|
|
|
m_JDController.SetupBodyPart(m_Right_Thigh);
|
|
m_JDController.SetupBodyPart(m_Right_Leg);
|
|
m_JDController.SetupBodyPart(m_Right_Foot);
|
|
|
|
m_JDController.SetupBodyPart(m_Left_Arm);
|
|
m_JDController.SetupBodyPart(m_Left_Forearm);
|
|
|
|
m_JDController.SetupBodyPart(m_Right_Arm);
|
|
m_JDController.SetupBodyPart(m_Right_Forearm);
|
|
}
|
|
|
|
StartCoroutine(DespawnTimer());
|
|
}
|
|
|
|
|
|
public void SetPool(ObjectPool<Body> pool)
|
|
{
|
|
m_Pool = pool;
|
|
}
|
|
|
|
IEnumerator DespawnTimer()
|
|
{
|
|
yield return new WaitForSecondsRealtime(m_DespawnTimer);
|
|
m_Pool.Release(this);
|
|
}
|
|
|
|
}
|
|
|