Skip to main content
Clarifying
Source Link
DMGregory
  • 136.3k
  • 22
  • 247
  • 373

How identify my gameto detect when fillup whole planethe player has filled a shape?

i m working 3DIn my game..

when i am store, the instantiateplayer is presented with a plane containing obstacles (paintobjectorange / blue) in my list? how identify the system when my fill up whole plane?? and game over and when fillup whole plane then going to the next scene.regions of empty space (white).

how identify my game when my plane fill up and going next scene??The player moves their green cube around the empty space, which instantiates a trail of green cubes behind it, painting the path they've travelled.

what i am tryingI need to dodetect when fill up my whole plane goingthe player has painted all of the empty space, so that they can proceed to nextscene??the next level.

Empty PlaneInitial state of the board:

enter image description hereSimple maze with a green square at one end of a channel

fillup planeWhen the player has painted all of the empty space:

enter image description hereSame maze, with the channel fully covered in green

public float speed = 10f; private RaycastHit hit; public GameObject paintcube; float maxdistance = 0Currently I store my instantiated paint objects in a list.51f; bool moves;

But I don't know how to check that the objects in this list cover all of the empty space. How can I do that?

public float speed = 10f;
private RaycastHit hit;
public GameObject paintcube;
float maxdistance = 0.51f;
bool moves;

    

private void FixedUpdate()
{
    Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * 3, Color.green);
    if (Physics.Raycast(transform.position,transform.TransformDirection(Vector3.forward), out hit, maxdistance/*,layerMask*/))
    {
         if (hit.collider.gameObject.tag == "myobstacle")
         {
             moves = false;                                                         
         }
         if(moves)
         {
             movepaint();
         }
     }
}    

public void movepaint()
{
     if (moves)
     {
         MyList.Add( Instantiate<GameObject>(paintcube, position, transform.rotation) );
     }
}        



    

How identify my game when fillup whole plane?

i m working 3D game..

when i am store the instantiate(paintobject) in my list? how identify the system when my fill up whole plane?? and game over and when fillup whole plane then going to the next scene..

how identify my game when my plane fill up and going next scene??

what i am trying to do when fill up my whole plane going to nextscene??

Empty Plane:

enter image description here

fillup plane:

enter image description here

public float speed = 10f; private RaycastHit hit; public GameObject paintcube; float maxdistance = 0.51f; bool moves;

private void FixedUpdate()
{
    Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * 3, Color.green);
    if (Physics.Raycast(transform.position,transform.TransformDirection(Vector3.forward), out hit, maxdistance/*,layerMask*/))
    {
        if (hit.collider.gameObject.tag == "myobstacle")
        {
            moves = false;                                                         
        }
        if(moves)
        {
            movepaint();
        }
    }
}   
public void movepaint()
{
    if (moves)
    {
        MyList.Add(Instantiate<GameObject>(paintcube, position, transform.rotation));
    }
}       

    

How to detect when the player has filled a shape?

In my game, the player is presented with a plane containing obstacles (orange / blue) and regions of empty space (white).

The player moves their green cube around the empty space, which instantiates a trail of green cubes behind it, painting the path they've travelled.

I need to detect when the player has painted all of the empty space, so that they can proceed to the next level.

Initial state of the board:

Simple maze with a green square at one end of a channel

When the player has painted all of the empty space:

Same maze, with the channel fully covered in green

Currently I store my instantiated paint objects in a list.

But I don't know how to check that the objects in this list cover all of the empty space. How can I do that?

public float speed = 10f;
private RaycastHit hit;
public GameObject paintcube;
float maxdistance = 0.51f;
bool moves;

    

private void FixedUpdate()
{
    Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * 3, Color.green);
    if (Physics.Raycast(transform.position,transform.TransformDirection(Vector3.forward), out hit, maxdistance/*,layerMask*/))
    {
         if (hit.collider.gameObject.tag == "myobstacle")
         {
             moves = false;                                                         
         }
         if(moves)
         {
             movepaint();
         }
     }
}    

public void movepaint()
{
     if (moves)
     {
         MyList.Add( Instantiate<GameObject>(paintcube, position, transform.rotation) );
     }
}        



    
edited title
Link

List has store the same object Repeatedly in List How identify my game when fillup whole plane?

Source Link

List has store the same object Repeatedly in List?

i m working 3D game..

when i am store the instantiate(paintobject) in my list? how identify the system when my fill up whole plane?? and game over and when fillup whole plane then going to the next scene..

how identify my game when my plane fill up and going next scene??

what i am trying to do when fill up my whole plane going to nextscene??

Empty Plane:

enter image description here

fillup plane:

enter image description here

public float speed = 10f; private RaycastHit hit; public GameObject paintcube; float maxdistance = 0.51f; bool moves;

private void FixedUpdate()
{
    Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * 3, Color.green);
    if (Physics.Raycast(transform.position,transform.TransformDirection(Vector3.forward), out hit, maxdistance/*,layerMask*/))
    {
        if (hit.collider.gameObject.tag == "myobstacle")
        {
            moves = false;                                                         
        }
        if(moves)
        {
            movepaint();
        }
    }
}   
public void movepaint()
{
    if (moves)
    {
        MyList.Add(Instantiate<GameObject>(paintcube, position, transform.rotation));
    }
}