public PortaUI EssaPorta(TipoDePorta tipo) { if (saida.tipoDePorta == tipo) return saida; else return entrada; }
public PortaUI OutraPorta(TipoDePorta tipo) { if (saida.tipoDePorta != tipo) return saida; else return entrada; }
public Porta(string nome,int offset, TipoDePorta tipo, WNode nodoPai) { Nome = nome; yOffset = offset; tipoDaPorta = tipo; nodoDono = nodoPai; cor = Color.white; switch(offset) { case 0: cor = Color.green; break; case 1: cor = Color.blue; break; case 2: cor = Color.red; break; case 3: cor = Color.yellow; break; case 4: cor = Color.black; break; case 5: cor = Color.cyan; break; default: Debug.LogError("erro cor da porta não suportada"); break; } //guiskin = Resources.Load<GUISkin>("GUISkinNode"); // textura = Resources.Load<Texture2D>("CirculoBranco"); textura = (Texture2D)Object.Instantiate(Resources.Load<Texture2D>("CirculoBranco")); Color[] colors = textura.GetPixels(); for (int i = 0; i < colors.Length; i++) { if (colors[i].a != 0) colors[i] = cor; } textura.SetPixels(colors); textura.Apply(); }
public void SetPortaUI(int _offset, TipoDePorta _tipoDePorta, TipoDeLigacao _tipoDeLigacao) { tipoDeLigacao = _tipoDeLigacao; tipoDePorta = _tipoDePorta; offset = _offset; if (tipoDePorta == TipoDePorta.Entrada) name = "Entrada" + offset.ToString()+ transform.parent.name; else name = "Saida" + offset.ToString()+ transform.parent.name; }
void AdicionarPorta(TipoDePorta tipo, string nome="Porta") { Porta porta = new Porta((int)listaDePortas.Count / 2); porta.Nome = nome; porta.tipoDaPorta = tipo; porta.nodoDono=this; _listaDePortas.Add(porta); }
public void DesenharCurva(Vector3 PosicaoInicial, Vector3 PosicaoFinal, Color cor, TipoDePorta tipo) { PosicaoInicial.z = 0; PosicaoFinal.z = 0; Vector3 TangenteInicial; Vector3 TangenteFinal; if (PosicaoInicial.x < PosicaoFinal.x) { TangenteInicial = PosicaoInicial + Vector3.right * 50; TangenteFinal = PosicaoFinal + Vector3.left * 50; } else { TangenteInicial = PosicaoInicial + Vector3.left * 50; TangenteFinal = PosicaoFinal + Vector3.right * 50; } Color corDeSombra = new Color(0, 0, 0, 0.06f); for (int i = 0; i < 3; i++) //desenha as sombras Handles.DrawBezier(PosicaoInicial, PosicaoFinal, TangenteInicial, TangenteFinal, corDeSombra, null, (i + 1) * 5); Handles.DrawBezier(PosicaoInicial, PosicaoFinal, TangenteInicial, TangenteFinal, cor, null, 5); }