IF Flashcards
public float xRange = 10.0f;
if (transform.position.x < -xRange)
{
transform.position = new Vector3 (-xRange, transform.position.y,transform.position.z);
}
public GameObject projectilePrefab;
pegar uma tecla p lançar objeto
if (Input.GetKeyDown(Key Code.Space))
{
Instantiate(projectilePrefab,transform.position, projectilePrefab.transform.rotation);
}
private float topBound;
Destruir o objeto do jogo
if (transform.position.z > topBound)
{
Destroy (gameObject);
}
private Rigidbody playerRb;
public float jumpForce;
public bool isOnground = true;
if (Input.GetKeyDown(Key Code.Space)&& isOnground)
{
playerRb.AddForce(Vector3.up*jumpForce,ForceMode.Impluse);
isOnground = false;
}
private float leftBound;
if (transform.position.x < leftBound && gameObject.CompareTag(“Obstacle”)
{
Destroy(gameObject);
}
public bool hasPowerup = false;
private void OnCollisionEnter(Collision collision)
{
If (collision.gameObject.CompareTag(“Enemy”) && hasPowerup)
{
Debug.Log(“Collided with” + collision.gameObject.name+”with Power up set to”+hasPowerup);
}
}