override public void Update()
{
hopper.Update();
attackCooldown -= Time.deltaTime;
if (attackCooldown < 0)
{
attackCooldown = RXRandom.Range(0.9f, 1.0f) * Config.VILLAGER_ATTACK_COOLDOWN;
if (Arena.instance != null && Arena.instance.dayManager.isDay)
{
CheckForAttack();
}
}
float scaleXMultiplier = body.scaleX < 0 ? -1f : 1f;
float scaleMultiplier = 1.0f;
if (hopper.jumpTime > 0)
{
scaleXMultiplier = (hopper.speedX < 0) ? -1.0f : 1.0f;
scaleMultiplier = 0.75f + 0.3f * hopper.jumpY;
}
body.scaleX = scaleXMultiplier / scaleMultiplier;
body.scaleY = scaleMultiplier;
bodySprite.y = offsetY + hopper.jumpY * hopper.config.jumpHeight;
colorSprite.y = bodySprite.y;
weapon.x = bodySprite.x + 4;
weapon.y = bodySprite.y + 4;
pushSpeed *= 0.93f;
if (pushSpeed.sqrMagnitude > 0.05f)
{
float newX = x + pushSpeed.x;
float newY = y + pushSpeed.y * Config.ISO_RATIO;
if (!entityArea.CheckVillPointHit(newX, newY))
{
x = newX;
y = newY;
}
else if (!entityArea.CheckVillPointHit(x, newY))
{
pushSpeed.x = -pushSpeed.x * 0.5f;
y = newY;
}
else if (!entityArea.CheckVillPointHit(newX, y))
{
x = newX;
pushSpeed.y = -pushSpeed.y * 0.5f;
}
}
body.SetPosition(x, y);
shadowSprite.SetPosition(x, y);
}