public override IEnumerator ActionOverTime(PawnComponent Pawn) { for (int i = 0; i < NSpawn; i++) { Spawn(PrefabSpawn, OffsetSpawn[i % OffsetSpawn.Length] + Pawn.GetPosition(), RotationSpawn[i % RotationSpawn.Length]); } yield break; }
public override IEnumerator ActionOverTime(PawnComponent Pawn) { Vector3 _origine = Pawn.GetPosition(); Vector3 _currentOffset = Vector3.zero; for (float t = 0f, perc = 0f; perc < 1f; t += Time.fixedDeltaTime) { perc = Mathf.Clamp01(t / Duration); _currentOffset.x = VecMove.x * perc; _currentOffset.y = VecMove.y * perc; Pawn.SetPosition(_origine + _currentOffset); yield return(_waitFixed); } }