IF + ELSE instead of IF + IF for door closing?

Hello all!
I was wondering if, for the door closing, i can use the ELSE (which still works) instead of the original lecture code.

    if (PressurePlate->IsOverlappingActor(ActorThatOpens))
{
	OpenDoor();
	LastDoorOpenTime = GetWorld()->GetTimeSeconds();
}
    else
{
	CloseDoor();
} 

original lecture code:

if (PressurePlate->IsOverlappingActor(ActorThatOpens))
{
	OpenDoor();
	LastDoorOpenTime = GetWorld()->GetTimeSeconds();
}
if (GetWorld()->GetTimeSeconds() - LastDoorOpenTime > CloseDoorDelay)
{
	CloseDoor();
}

You can of course but then the door would close as soon as you leave the pressure plate?

okay nice!
thanks Nick

Privacy & Terms