Commit c29eb377 authored by BRUNEAU Julien's avatar BRUNEAU Julien
Browse files

+ few fixes avant merge master

parent ae4dae89
......@@ -24,9 +24,9 @@ RenderSettings:
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_AmbientMode: 1
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
......@@ -729,7 +729,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 52392898}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
......@@ -1783,7 +1783,7 @@ Transform:
m_LocalScale: {x: 0.1, y: 1.7, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &161083060
GameObject:
......@@ -2848,7 +2848,7 @@ RectTransform:
m_Children:
- {fileID: 1688068859}
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
......@@ -3010,10 +3010,9 @@ Transform:
m_LocalPosition: {x: 20, y: 15, z: 6}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1745372759}
- {fileID: 436011568}
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &284381506
GameObject:
......@@ -5228,7 +5227,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 275588661}
m_RootOrder: 1
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &447817917
GameObject:
......@@ -5322,7 +5321,7 @@ Transform:
m_LocalScale: {x: 500, y: 1, z: 500}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &455666300
GameObject:
......@@ -8410,7 +8409,7 @@ RectTransform:
m_Children:
- {fileID: 1308346734}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
......@@ -12963,7 +12962,7 @@ RectTransform:
- {fileID: 1235341451}
- {fileID: 1741252960}
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
......@@ -13034,7 +13033,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1235341450
GameObject:
......@@ -13903,13 +13902,13 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1280542069}
m_TextComponent: {fileID: 1502587222}
m_Placeholder: {fileID: 52392900}
m_ContentType: 0
m_ContentType: 2
m_InputType: 0
m_AsteriskChar: 42
m_KeyboardType: 0
m_KeyboardType: 4
m_LineType: 0
m_HideMobileInput: 0
m_CharacterValidation: 0
m_CharacterValidation: 1
m_CharacterLimit: 0
m_OnEndEdit:
m_PersistentCalls:
......@@ -13920,7 +13919,7 @@ MonoBehaviour:
m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_CustomCaretColor: 0
m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412}
m_Text:
m_Text: -1
m_CaretBlinkRate: 0.85
m_CaretWidth: 1
m_ReadOnly: 0
......@@ -16940,7 +16939,7 @@ MonoBehaviour:
m_HorizontalOverflow: 1
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
m_Text: -1
--- !u!222 &1502587223
CanvasRenderer:
m_ObjectHideFlags: 0
......@@ -19944,13 +19943,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1745372758}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalRotation: {x: -0.24091417, y: 0.7433922, z: -0.34406087, w: -0.52052915}
m_LocalPosition: {x: 20, y: 15, z: 6}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 275588661}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 49.672, y: -110.00001, z: 0}
--- !u!108 &1745372760
Light:
m_ObjectHideFlags: 0
......@@ -21227,7 +21226,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1898254886
MonoBehaviour:
......@@ -22346,7 +22345,7 @@ Transform:
m_LocalScale: {x: 1, y: 0.85, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1999162010
GameObject:
......
......@@ -38,6 +38,7 @@ public class LoadEnv : MonoBehaviour
CamMvt cam_Movement; // Control camera movement behavior
private FiltersControl cam_fc; // Control camera filters
private MenuManager menuM; // Control the starting menu
private GameObject crowdParent; // Parent object for all agents
//private float rotSpeed = 5;
// --------------------------
......@@ -134,7 +135,8 @@ public class LoadEnv : MonoBehaviour
if (info.Length == 0)
info = dir.GetFiles("*.txt");
var crowdParentObject = new GameObject("Crowd");
if (crowdParent==null)
crowdParent = new GameObject("Crowd");
FollowTrajectory tmpFollower;
int i = 0;
......@@ -144,7 +146,7 @@ public class LoadEnv : MonoBehaviour
// ------------------------------------------------------------
// IF NO ROCKETMAN (PROPRIETARY ASSETS), USE PLASTICMAN INSTEAD
GameObject character = (testRocketMan!=null) ? CreateAgent_RocketBox(i) : CreateAgent_PlasticMan(i);
character.transform.parent = crowdParentObject.transform;
character.transform.parent = crowdParent.transform;
avatars.Add(character);
// ---------------------
// SET NAME, TAG, AND ID
......@@ -173,7 +175,7 @@ public class LoadEnv : MonoBehaviour
}
nbAgent = avatars.Count;
cmptDone = 0;
cam_Movement.initializeTargetObjects();
cam_Movement.initializeTargetObjects(avatars.ToArray());
cam_fc.OnSceneChange();
}
......@@ -456,7 +458,7 @@ public class LoadEnv : MonoBehaviour
Camera.main.GetComponent<CamRecorder>().Init();
InitDeepRecorders();
cam_Movement.initializeTargetObjects();
cam_Movement.initializeTargetObjects(avatars.ToArray());
cam_fc.OnSceneChange();
}
......
......@@ -208,8 +208,6 @@ public class MenuManager : MonoBehaviour
env = gameObject.GetComponent<LoadEnv>();
env.loadScenario(ConfigReader.trajectoriesDir);
ConfigReader.camResolution = CommandLine.GetCamResolution();
//menu.SetActive(false);
//configPanel.SetActive(false);
......@@ -327,22 +325,24 @@ public class MenuManager : MonoBehaviour
/// </summary>
public void toogleMenu()
{
if(panel.activeSelf==false)
{
panel.SetActive(!panel.activeSelf);
controlPanel.SetActive(!panel.activeSelf);
topMenuPanel.SetActive(!panel.activeSelf);
cameraMovPanel.SetActive(!panel.activeSelf);
slider.SetActive(!panel.activeSelf);
replayButton.SetActive(!panel.activeSelf);
//if(panel.activeSelf==false)
//{
panel.SetActive(!panel.activeSelf);
controlPanel.SetActive(!panel.activeSelf);
topMenuPanel.SetActive(!panel.activeSelf);
cameraMovPanel.SetActive(!panel.activeSelf);
slider.SetActive(!panel.activeSelf);
replayButton.SetActive(!panel.activeSelf);
GameObject[] list = GameObject.FindGameObjectsWithTag("Player");
foreach(GameObject a in list)
Destroy(a);
Pause();
//GameObject[] list = GameObject.FindGameObjectsWithTag("Player");
//foreach(GameObject a in list)
// Destroy(a);
//Time.timeScale = 0;
//}
Time.timeScale = 0;
}
}
/// <summary>
......
......@@ -65,6 +65,9 @@ public class CamMvt : MonoBehaviour
public bool followOnX; // Lock axe X of the camera during camera's translation if false
public bool followOnY; // Lock axe Z of the camera during camera's translation if false
// Agent list
GameObject[] agentList;
// Head and Torsum references
private Transform agent_head_transform; // transform reference of the head of the current followID agent
private string[] head_names = new string[] { "HEAD", "Head", "head" }; //names of the head transform
......@@ -103,8 +106,10 @@ public class CamMvt : MonoBehaviour
/// <summary>
/// Initialize the targets of the camera movement with parameters of config file
/// </summary>
public void initializeTargetObjects()
public void initializeTargetObjects(GameObject[] list)
{
agentList = list;
//initial positions
_default_position = transform.position;
_default_rotation = transform.eulerAngles;
......@@ -128,14 +133,12 @@ public class CamMvt : MonoBehaviour
/// </summary>
public void update_look_at_target()
{
GameObject[] list = GameObject.FindGameObjectsWithTag("Player");
if (activateLookAt && lookAt_Id >= 0 && list.Length > 0)
if (activateLookAt && lookAt_Id >= 0 && agentList.Length > 0)
{
if (lookAt_Id > list.Length - 1)
lookAt_Id = list.Length - 1;
if (lookAt_Id > agentList.Length - 1)
lookAt_Id = agentList.Length - 1;
_previous_lookAt_Id = lookAt_Id;
lookAt_Agent = list[lookAt_Id];
lookAt_Agent = agentList[lookAt_Id];
}
else
{
......@@ -148,14 +151,12 @@ public class CamMvt : MonoBehaviour
/// </summary>
public void update_follow_target()
{
GameObject[] list = GameObject.FindGameObjectsWithTag("Player");
if (activateFollow && follow_Id >= 0 && list.Length > 0)
if (activateFollow && follow_Id >= 0 && agentList.Length > 0)
{
if (follow_Id > list.Length - 1)
follow_Id = list.Length - 1;
if (follow_Id > agentList.Length - 1)
follow_Id = agentList.Length - 1;
_previous_follow_Id = follow_Id;
follow_Agent = list[follow_Id];
follow_Agent = agentList[follow_Id];
//initialize the positions
follow_LastPosition = follow_Agent.transform.position;
......@@ -224,8 +225,7 @@ public class CamMvt : MonoBehaviour
else if (current_camera_mode == FOLLOW)
{
//activate and set 0 id in case or not predefined id
GameObject[] list = GameObject.FindGameObjectsWithTag("Player");
if (follow_Id < 0 && list.Length > 0)
if (follow_Id < 0 && agentList.Length > 0)
{
follow_Id = 0;
panelMovCamera.transform.Find("AgentID").GetComponent<InputField>().text = follow_Id.ToString();
......@@ -233,13 +233,13 @@ public class CamMvt : MonoBehaviour
activateFollow = true;
//set default rotation
transform.eulerAngles = _default_rotation;
//transform.eulerAngles = _default_rotation;
_position_follow = Camera.main.transform.position;
}
else if (current_camera_mode == LOOK_AT)
{
//activate and set 0 id in case or not predefined id
GameObject[] list = GameObject.FindGameObjectsWithTag("Player");
if (lookAt_Id < 0 && list.Length > 0)
if (lookAt_Id < 0 && agentList.Length > 0)
{
lookAt_Id = 0;
panelMovCamera.transform.Find("AgentID").GetComponent<InputField>().text = lookAt_Id.ToString();
......@@ -247,15 +247,14 @@ public class CamMvt : MonoBehaviour
activateLookAt = true;
//set default position and rotation
transform.eulerAngles = _default_rotation;
transform.position = _default_position;
//transform.eulerAngles = _default_rotation;
//transform.position = _default_position;
}
else if (current_camera_mode == FIRST_PERSON)
{
//activate and set 0 id in case or not predefined id
GameObject[] list = GameObject.FindGameObjectsWithTag("Player");
if (follow_Id < 0 && list.Length > 0)
if (follow_Id < 0 && agentList.Length > 0)
{
follow_Id = 0;
panelMovCamera.transform.Find("AgentID").GetComponent<InputField>().text = follow_Id.ToString();
......@@ -272,8 +271,7 @@ public class CamMvt : MonoBehaviour
else if (current_camera_mode == TORSUM)
{
//activate and set 0 id in case or not predefined id
GameObject[] list = GameObject.FindGameObjectsWithTag("Player");
if (follow_Id < 0 && list.Length > 0)
if (follow_Id < 0 && agentList.Length > 0)
{
follow_Id = 0;
panelMovCamera.transform.Find("AgentID").GetComponent<InputField>().text = follow_Id.ToString();
......@@ -326,36 +324,34 @@ public class CamMvt : MonoBehaviour
if (current_camera_mode == FOLLOW)
{
//activate and set 0 id in case or not predefined id
GameObject[] list = GameObject.FindGameObjectsWithTag("Player");
if (follow_Id < 0 && list.Length > 0)
if (follow_Id < 0 && agentList.Length > 0)
{
follow_Id = 0;
}
activateFollow = true;
//set default rotation
transform.eulerAngles = _default_rotation;
//transform.eulerAngles = _default_rotation;
_position_follow = Camera.main.transform.position;
}
else if (current_camera_mode == LOOK_AT)
{
//activate and set 0 id in case or not predefined id
GameObject[] list = GameObject.FindGameObjectsWithTag("Player");
if (lookAt_Id < 0 && list.Length > 0)
if (lookAt_Id < 0 && agentList.Length > 0)
{
lookAt_Id = 0;
}
activateLookAt = true;
//set default position and rotation
transform.eulerAngles = _default_rotation;
transform.position = _default_position;
//transform.eulerAngles = _default_rotation;
//transform.position = _default_position;
}
else if (current_camera_mode == FIRST_PERSON)
{
//activate and set 0 id in case or not predefined id
GameObject[] list = GameObject.FindGameObjectsWithTag("Player");
if (follow_Id < 0 && list.Length > 0)
if (follow_Id < 0 && agentList.Length > 0)
{
follow_Id = 0;
}
......@@ -371,8 +367,7 @@ public class CamMvt : MonoBehaviour
else if (current_camera_mode == TORSUM)
{
//activate and set 0 id in case or not predefined id
GameObject[] list = GameObject.FindGameObjectsWithTag("Player");
if (follow_Id < 0 && list.Length > 0)
if (follow_Id < 0 && agentList.Length > 0)
{
follow_Id = 0;
}
......
......@@ -140,15 +140,6 @@ public static class ConfigReader
set { data.cam.rotation = new ConfigVect3(value); }
}
/// <summary>
/// Camera Resolution
/// </summary>
static public Vector2 camResolution
{
get { return data.cam.CamResolution.vect; }
set { data.cam.CamResolution = new ConfigVect2(value); }
}
/// <summary>
/// Boolean, true if the LookAtAgent id greater than -1
/// </summary>
......@@ -423,15 +414,13 @@ public class ConfigCam
public ConfigCamBehaviour1 lookAtAgent;
public ConfigCamBehaviour2 followAgent;
public ConfigVect2 CamResolution;
public ConfigCam()
{
position = new ConfigVect3();
rotation = new ConfigVect3();
lookAtAgent = new ConfigCamBehaviour1();
followAgent = new ConfigCamBehaviour2();
CamResolution = new ConfigVect2(new Vector2(-1,-1));
cameraType = new ConfigCamType();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment