UNASP-TI / vida10

2 stars 0 forks source link

Criar objeto casa - 5 Pontos #12

Closed alciomarhollanda closed 8 months ago

Isaiaz1 commented 8 months ago
Screenshot_1casaetc Screenshot2233 Screenshot11

Script em C# do objeto casa

`using System.Collections; using System.Collections.Generic; using UnityEngine;

public class NewBehaviourScript : MonoBehaviour // NewBehaviourScript : MonoBehaviour { //variaveis do objeto que aparecem no projeto // Start is called before the first frame update [SerializeField]private int NumeroDeQuartos = 2; [SerializeField]private int NumeroDePortas = 3;

private MeshRenderer MeshRenderer;

private float horizontal; private float vertical; [SerializeField]private int velocidade;

void Start()
{
     NumeroDePortas = 3;
    NumeroDeQuartos = 2;
    MeshRenderer = GetComponent<MeshRenderer>();
}

// Update is called once per frame
void Update()
{
    Sumir();
    Mover();
}

//Mover o objeto void Mover(){ horizontal = Input.GetAxis("Horizontal"); vertical = Input.GetAxis("Vertical");

transform.Translate(new Vector3(horizontal,vertical,0)Time.deltaTimevelocidade);
} //animaçao de desativar o objeto void Sumir(){ if (Input.GetKeyDown(KeyCode.C)){ gameObject.SetActive(!gameObject.activeSelf); }

} }`

Isaiaz1 commented 8 months ago

New Piskelcasa1 (22) New Piskelcasa11

Screenshot_1newcasa3010

` using System.Collections; using System.Collections.Generic; using UnityEngine;

public class NewBehaviourScript : MonoBehaviour // NewBehaviourScript : MonoBehaviour { //variaveis do objeto que aparecem no projeto // Start is called before the first frame update [SerializeField]private int NumeroDeQuartos = 2; [SerializeField]private int NumeroDePortas = 3;

private MeshRenderer MeshRenderer;

private float horizontal; private float vertical; [SerializeField]private int velocidade;

void Start()
{
     NumeroDePortas = 3;
    NumeroDeQuartos = 2;
    MeshRenderer = GetComponent<MeshRenderer>();
}

// Update is called once per frame
void Update()
{
    Sumir();
    Mover();
}

//Mover o objeto void Mover(){ horizontal = Input.GetAxis("Horizontal"); vertical = Input.GetAxis("Vertical");

transform.Translate(new Vector3(horizontal,vertical,0)Time.deltaTimevelocidade);
} //animaçao de desativar o objeto void Sumir(){ if (Input.GetKeyDown(KeyCode.C)){ gameObject.SetActive(!gameObject.activeSelf); }

} } `