IF Flashcards

1
Q

public float xRange = 10.0f;

A

if (transform.position.x < -xRange)
{
transform.position = new Vector3 (-xRange, transform.position.y,transform.position.z);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

public GameObject projectilePrefab;

pegar uma tecla p lançar objeto

A

if (Input.GetKeyDown(Key Code.Space))
{
Instantiate(projectilePrefab,transform.position, projectilePrefab.transform.rotation);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

private float topBound;

Destruir o objeto do jogo

A

if (transform.position.z > topBound)
{
Destroy (gameObject);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

private Rigidbody playerRb;
public float jumpForce;
public bool isOnground = true;

A

if (Input.GetKeyDown(Key Code.Space)&& isOnground)
{
playerRb.AddForce(Vector3.up*jumpForce,ForceMode.Impluse);
isOnground = false;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

private float leftBound;

A

if (transform.position.x < leftBound && gameObject.CompareTag(“Obstacle”)
{
Destroy(gameObject);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

public bool hasPowerup = false;

A

private void OnCollisionEnter(Collision collision)
{
If (collision.gameObject.CompareTag(“Enemy”) && hasPowerup)
{
Debug.Log(“Collided with” + collision.gameObject.name+”with Power up set to”+hasPowerup);
}
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly