Commit cf806ebe authored by pet's avatar pet

instancia moleculas na fase do ciclo de krebs

parent 5b0494bf
......@@ -330,6 +330,7 @@ GameObject:
- 114: {fileID: 2143440484}
- 114: {fileID: 2143440486}
- 114: {fileID: 2143440487}
- 114: {fileID: 2143440488}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
......@@ -348,6 +349,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 995c806cb0ccb41e892770ce9a7587af, type: 3}
m_Name:
m_EditorClassIdentifier:
offset_rel_barra: 0.16
compr_rel_barra: 0.6
pos_rel_areas: 0.1
tam_rel_areas: 0.1
......@@ -516,6 +518,7 @@ MonoBehaviour:
molecula: {fileID: 1743024017}
dificuldade: 1
s_barra: {fileID: 2143440484}
s_tela: {fileID: 2143440487}
cam: {fileID: 1061338285}
--- !u!114 &2143440487
MonoBehaviour:
......@@ -528,3 +531,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c1da832dabae34e348546e2d838c5dac, type: 3}
m_Name:
m_EditorClassIdentifier:
cam: {fileID: 1061338285}
--- !u!114 &2143440488
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2143440483}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7ac269eef2208411d8246247ba628c96, type: 3}
m_Name:
m_EditorClassIdentifier:
pos_rel_mol: {x: 0.1, y: 0.1}
s_tela: {fileID: 2143440487}
prefabs:
- {fileID: 100000, guid: 1436ef0fe9a7f4f22a25f7c987329016, type: 3}
- {fileID: 100000, guid: 1436ef0fe9a7f4f22a25f7c987329016, type: 3}
- {fileID: 100000, guid: 1436ef0fe9a7f4f22a25f7c987329016, type: 3}
#pragma strict
public var offset_rel_barra : float = 0.0;
public var compr_rel_barra : float = 0.6; // em relação ao comprimento da tela
public var pos_rel_areas : float = 0.1; // em relação ao ponto inicial da barra
public var tam_rel_areas : float = 0.1; // em relação ao comprimento da tela
......@@ -55,7 +55,7 @@ function Start () {
function Update () {
/* CÁLCULOS PARA RESPONSIVIDADE */
ponto_inicial_barra.x = Screen.width * ((1 - compr_rel_barra)/2);
ponto_inicial_barra.x = Screen.width * ((1 - compr_rel_barra)/2 + offset_rel_barra);
ponto_inicial_barra.y = (Screen.height * 0.2 < 100)?Screen.height*0.2:100;
ponto_final_barra.x = Screen.width * compr_rel_barra + ponto_inicial_barra.x;
ponto_final_barra.y = ponto_inicial_barra.y + altura_barra;
......
#pragma strict
public var pos_rel_mol : Vector2;
public var s_tela : Tela;
public var prefabs : GameObject[];
private var moleculas : GameObject[];
function Start () {
s_tela = transform.GetComponent("Tela");
moleculas = new GameObject[prefabs.length];
for(var i: int =0; i < prefabs.length; i++)
prefabs[i].transform.localScale = Vector3(0.2,0.2,0.2);
for(i = 0; i < moleculas.length; i++)
moleculas[i] = Instantiate(prefabs[i],s_tela.converte_Tela_Mundo(Vector2(Screen.width*pos_rel_mol.x*(1+ i%2), Screen.height*pos_rel_mol.y*(1 + i/2)),0),Quaternion.Euler(0,0,0));
}
function Update () {
}
fileFormatVersion: 2
guid: 7ac269eef2208411d8246247ba628c96
timeCreated: 1488802780
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -5,13 +5,14 @@ public var molecula : GameObject;
public var dificuldade : float = 1;
var s_barra : Barra;
var s_tela : Tela;
var cam : Camera;
private var centro_barra: Vector2;
function Start () {
s_barra = transform.GetComponent("Barra");
s_tela = transform.GetComponent("Tela");
}
function Update () {
......@@ -28,20 +29,6 @@ function Update () {
molecula.transform.position = converte(pos2d,0);
Debug.Log(offset);
}
// a função do tela.js não funcionou para mim.....
// ass : Matheus
function converte(pos : Vector2, profundidade : float) : Vector3 {
var Rpos : Vector3;
Rpos.z = profundidade;
Rpos.y = cam.orthographicSize - 2*cam.orthographicSize*pos.y/Screen.height;
Rpos.x = 2*cam.orthographicSize*cam.aspect*pos.x/Screen.width - cam.orthographicSize*cam.aspect;
molecula.transform.position = s_tela.converte_Tela_Mundo(pos2d,0);
return Rpos;
}
#pragma strict
static var tamTela : Vector2;
var cam : Camera;
function Start () {
//Gerencia a responsividade
......@@ -31,3 +31,13 @@ static function worldPosi_to_screenPosi(x : float, y : float) : Vector2{
retorno.y = ((tamTela.y - y)/(2*tamTela.y))*Screen.height;
return retorno;
}
function converte_Tela_Mundo(pos : Vector2, profundidade : float) : Vector3 {
var Rpos : Vector3;
Rpos.z = profundidade;
Rpos.y = cam.orthographicSize - 2*cam.orthographicSize*pos.y/Screen.height;
Rpos.x = 2*cam.orthographicSize*cam.aspect*pos.x/Screen.width - cam.orthographicSize*cam.aspect;
return Rpos;
}
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