2026-08-10 14:57:50 +01:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
2021-02-26 19:01:47 +00:00
|
|
|
using UnityEngine;
|
2026-09-14 17:39:12 +02:00
|
|
|
using CultMath;
|
|
|
|
|
using static CultMath.math;
|
2021-02-26 19:01:47 +00:00
|
|
|
|
|
|
|
|
public class ShieldTest : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public float Acceleration;
|
|
|
|
|
private float _velocity;
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
2026-08-10 14:57:50 +01:00
|
|
|
_velocity += -sign(transform.position.x) * Acceleration * Time.deltaTime;
|
2021-02-26 19:01:47 +00:00
|
|
|
transform.position += Vector3.right * (_velocity * Time.deltaTime);
|
2026-08-10 14:57:50 +01:00
|
|
|
}
|
2021-02-26 19:01:47 +00:00
|
|
|
|
2026-08-10 14:57:50 +01:00
|
|
|
private void OnCollisionEnter(Collision other)
|
|
|
|
|
{
|
|
|
|
|
_velocity = -_velocity;
|
2021-02-26 19:01:47 +00:00
|
|
|
}
|
|
|
|
|
}
|