2026-05-23 08:27:50 -04:00
|
|
|
using Cielonos.MainGame.Characters;
|
2025-11-25 08:19:33 -05:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Cielonos.MainGame
|
|
|
|
|
{
|
|
|
|
|
public class LinearDirectionMoveSubmodule : MoveSubmoduleBase
|
|
|
|
|
{
|
|
|
|
|
public Vector3 direction;
|
|
|
|
|
public float speed;
|
|
|
|
|
public float acceleration;
|
2025-12-08 05:27:53 -05:00
|
|
|
public bool disableNegative;
|
|
|
|
|
|
2025-11-25 08:19:33 -05:00
|
|
|
|
2025-12-08 05:27:53 -05:00
|
|
|
public LinearDirectionMoveSubmodule(AttackAreaBase attackArea, Vector3 direction, float speed, float acceleration,
|
|
|
|
|
bool overrideRotation, bool disableNegative, bool stopWhenHit, float timeScaleCoefficient) :
|
|
|
|
|
base(attackArea, stopWhenHit, timeScaleCoefficient)
|
2025-11-25 08:19:33 -05:00
|
|
|
{
|
|
|
|
|
this.direction = direction;
|
|
|
|
|
this.speed = speed;
|
|
|
|
|
this.acceleration = acceleration;
|
2025-12-08 05:27:53 -05:00
|
|
|
this.disableNegative = disableNegative;
|
2025-11-25 08:19:33 -05:00
|
|
|
this.timeScaleCoefficient = timeScaleCoefficient;
|
|
|
|
|
if (overrideRotation)
|
|
|
|
|
{
|
|
|
|
|
attackArea.topParent.transform.rotation = Quaternion.LookRotation(direction);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Update()
|
|
|
|
|
{
|
2026-05-10 11:47:55 -04:00
|
|
|
speed += acceleration * (timeScaleCoefficient * attackArea.creator.selfTimeSm.DeltaTime);
|
2026-05-26 00:21:27 -04:00
|
|
|
//speed = Mathf.Max(0, speed);
|
2025-12-08 05:27:53 -05:00
|
|
|
|
|
|
|
|
if ((disableNegative && speed < 0) || !canMove)
|
|
|
|
|
{
|
|
|
|
|
speed = 0;
|
|
|
|
|
}
|
2026-05-23 08:27:50 -04:00
|
|
|
|
|
|
|
|
float projectileSpeedMultiplier = attackArea.creator.attributeSm[CharacterAttribute.ProjectileSpeedMultiplier];
|
2025-12-08 05:27:53 -05:00
|
|
|
|
2026-05-23 08:27:50 -04:00
|
|
|
unscaledVelocity = direction * (speed * projectileSpeedMultiplier);
|
2026-05-10 11:47:55 -04:00
|
|
|
scaledVelocity = unscaledVelocity * timeScaleCoefficient;
|
|
|
|
|
attackArea.topParent.transform.position += scaledVelocity * attackArea.creator.selfTimeSm.DeltaTime;
|
2025-11-25 08:19:33 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|