Aetheria/Assets/Scripts/Gameplay/ShieldTest.cs
Reinier Vens 11a55e236b Loot
Fixed: unable to undock with an aetheric drive (game requires locomotion)
Entities have a chance of dropping any item on board when killed
Mine behavior generalized to grid objects, used in dropped loot
Added tractor beam (not itemized yet) which pulls in nearby loot (and mines!)
Items are added to player inventory when they collide with the ship (and mines explode!)
Added console command to spawn turret
2021-04-15 04:25:22 +01:00

23 lines
570 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Mathematics;
using static Unity.Mathematics.math;
public class ShieldTest : MonoBehaviour
{
public float Acceleration;
private float _velocity;
// Update is called once per frame
void Update()
{
_velocity += -sign(transform.position.x) * Acceleration * Time.deltaTime;
transform.position += Vector3.right * (_velocity * Time.deltaTime);
}
private void OnCollisionEnter(Collision other)
{
_velocity = -_velocity;
}
}