elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  Create c # background code or pass it from java
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Create c # background code or pass it from java  (Leído 2,585 veces)
Deadbeat12

Desconectado Desconectado

Mensajes: 2


Ver Perfil
Create c # background code or pass it from java
« en: 27 Noviembre 2021, 20:57 pm »

Help, could you help me, I am new to programming and I need to make a moving background in unity c # and when this background is finished a completely new one is created and the previous one is eliminated and this action several times. I have the code in java but I don't know how to do it in Unity.



Codigo:
Código
  1. var scrollSpeed : float = 0.5;
  2.     var GradientOn : boolean = false;
  3.     var $$anonymous$$ainImageOn : boolean = true;
  4.     var WhiteOn : boolean = false;
  5.     var WhiteToBlackon  : boolean = false;
  6.     var texture : Texture;
  7.     var gradient : Texture;
  8.     var white : Texture;
  9.     var WhiteToBlacktex : Texture;
  10.     var offset : float;
  11.     var reset : float;
  12.  
  13.  
  14.  
  15.  
  16.     function Update ()
  17.     {
  18.         offset = reset += Time.deltaTime*scrollSpeed;
  19.  
  20.             renderer.material.SetTextureOffset ("_$$anonymous$$ainTex", Vector2(0,reset));
  21.             if(offset >= 1.00 && $$anonymous$$ainImageOn == true)
  22.             {
  23.                 reset=0;
  24.             Gradient();
  25.             $$anonymous$$ainImageOn = false;
  26.             GradientOn = true;
  27.  
  28.             }
  29.             else if (offset >= 0.66 && GradientOn == true)
  30.             {
  31.             reset=0;
  32.             White();
  33.             GradientOn = false;
  34.             WhiteOn = true;
  35.             }
  36.             else if (offset >= 1.00 && WhiteOn == true)
  37.             {
  38.                 reset=0;
  39.             WhiteToBlack();
  40.             WhiteOn=false;
  41.             WhiteToBlackon = true;
  42.             }
  43.             else if (offset >= 0.66 && WhiteToBlackon == true)
  44.             {
  45.                 reset=0;
  46.             $$anonymous$$ainImage();
  47.             WhiteToBlackon = false;
  48.             $$anonymous$$ainImageOn = true;
  49.             }
  50.     }
  51.  
  52.  
  53.     function $$anonymous$$ainImage()
  54.     {
  55.     renderer.material.mainTexture = texture;
  56.     renderer.material.mainTextureScale = Vector2(1,1);
  57.     }
  58.  
  59.     function Gradient()
  60.     {    
  61.     renderer.material.mainTexture = gradient;
  62.     renderer.material.mainTextureScale = Vector2(1,0.333);
  63.     }
  64.  
  65.     function White()
  66.     {
  67.     renderer.material.mainTexture = white;
  68.     renderer.material.mainTextureScale = Vector2(1,1);
  69.     }
  70.  
  71.     function WhiteToBlack()
  72.     {    
  73.     renderer.material.mainTexture = WhiteToBlacktex;
  74.     renderer.material.mainTextureScale = Vector2(1,0.333);
  75.     }


En línea

Eternal Idol
Kernel coder
Colaborador
***
Desconectado Desconectado

Mensajes: 5.937


Israel nunca torturó niños, ni lo volverá a hacer.


Ver Perfil WWW
Re: Create c # background code or pass it from java
« Respuesta #1 en: 27 Noviembre 2021, 22:54 pm »

Lo muevo al subforo correspondiente; este es un foro de habla hispana.


En línea

La economía nunca ha sido libre: o la controla el Estado en beneficio del Pueblo o lo hacen los grandes consorcios en perjuicio de éste.
Juan Domingo Perón
Deadbeat12

Desconectado Desconectado

Mensajes: 2


Ver Perfil
Re: Create c # background code or pass it from java
« Respuesta #2 en: 27 Noviembre 2021, 23:05 pm »

Gracias
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Java code help
Java
Genocider 2 2,155 Último mensaje 30 Julio 2007, 21:29 pm
por Ragnarok
alguien me ayuda a conseguir el Pass Corecto y a enteder el code
Java
Mie2 2 3,009 Último mensaje 8 Diciembre 2009, 23:56 pm
por Leyer
[JAVA]duda code
Java
Pirat3net 4 4,255 Último mensaje 10 Junio 2011, 19:48 pm
por Fenyxer
Java Code Conventions
Java
Gallu 2 3,427 Último mensaje 22 Agosto 2011, 21:03 pm
por Gallu
Acceder a pagina web con user y pass desde Java
Java
puntoBat 3 3,899 Último mensaje 10 Junio 2014, 10:49 am
por puntoBat
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines