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 Importing.Items.Placements.EntranceExit FirstEnex { get; private set; }
public Importing.Items.Placements.EntranceExit SecondEnex { get; private set; }
bool m_ignoreNextCollisionWithSecondEnex = false;
private Coroutine m_findGroundCoroutine;
@ -650,12 +651,22 @@ namespace SanAndreasUnity.Behaviours
if (enex.Info == this.SecondEnex)
{
// we collided with second enex
if (m_ignoreNextCollisionWithSecondEnex)
{
// ignore this collision
// 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
{
var matchingEnexes = Importing.Items.Item.Enexes.Where(e => e.Name == enex.Info.Name && e != enex.Info);
@ -668,7 +679,8 @@ namespace SanAndreasUnity.Behaviours
// remember first and second enex
this.FirstEnex = enex.Info;
this.SecondEnex = counterPart;
// teleport
// teleport to second enex
m_ignoreNextCollisionWithSecondEnex = true;
this.TeleportToEnex(counterPart);
}
}