ignore next collision with second enex

This commit is contained in:
in0finite 2019-11-21 17:54:46 +01:00
parent 66d1709492
commit a12f8aebc1

View file

@ -98,6 +98,7 @@ namespace SanAndreasUnity.Behaviours
public EntranceExitMapObject CurrentCollidingEnex { get; private set; } public EntranceExitMapObject CurrentCollidingEnex { get; private set; }
public Importing.Items.Placements.EntranceExit FirstEnex { get; private set; } public Importing.Items.Placements.EntranceExit FirstEnex { get; private set; }
public Importing.Items.Placements.EntranceExit SecondEnex { get; private set; } public Importing.Items.Placements.EntranceExit SecondEnex { get; private set; }
bool m_ignoreNextCollisionWithSecondEnex = false;
private Coroutine m_findGroundCoroutine; private Coroutine m_findGroundCoroutine;
@ -650,11 +651,21 @@ namespace SanAndreasUnity.Behaviours
if (enex.Info == this.SecondEnex) if (enex.Info == this.SecondEnex)
{ {
// we collided with second enex // we collided with second enex
// teleport back to first enex ; reset first and second enex
var tmpEnex = this.FirstEnex; if (m_ignoreNextCollisionWithSecondEnex)
this.FirstEnex = null; {
this.SecondEnex = null; // ignore this collision
this.TeleportToEnex(tmpEnex); // collision will be processed next time
m_ignoreNextCollisionWithSecondEnex = false;
}
else
{
// teleport back to first enex ; reset first and second enex
var tmpEnex = this.FirstEnex;
this.FirstEnex = null;
this.SecondEnex = null;
this.TeleportToEnex(tmpEnex);
}
} }
else else
{ {
@ -668,7 +679,8 @@ namespace SanAndreasUnity.Behaviours
// remember first and second enex // remember first and second enex
this.FirstEnex = enex.Info; this.FirstEnex = enex.Info;
this.SecondEnex = counterPart; this.SecondEnex = counterPart;
// teleport // teleport to second enex
m_ignoreNextCollisionWithSecondEnex = true;
this.TeleportToEnex(counterPart); this.TeleportToEnex(counterPart);
} }
} }