enemy slidey

This commit is contained in:
Cat Flynn 2021-01-11 10:21:24 +00:00
parent 234e94a46b
commit dd5b94f9ad
3 changed files with 48 additions and 0 deletions

View File

@ -16,6 +16,7 @@ GameObject:
- component: {fileID: 2122656558574222561}
- component: {fileID: -3971665732303992234}
- component: {fileID: -4901459127090716512}
- component: {fileID: 1858863165099212332}
m_Layer: 7
m_Name: Enemy
m_TagString: Untagged
@ -151,3 +152,16 @@ MonoBehaviour:
m_EditorClassIdentifier:
xMin: -10.1
xMax: 10.1
--- !u!114 &1858863165099212332
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1738226812227614583}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ea3f51bb4cd6c8146a185362df2fe451, type: 3}
m_Name:
m_EditorClassIdentifier:
_speedRange: {x: -5, y: 5}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class SlideSideways : MonoBehaviour
{
[SerializeField] private Vector2 _speedRange;
private float _speed;
private void Start()
{
var r = new Unity.Mathematics.Random((uint)(Time.time*1000f));
_speed = r.NextFloat(_speedRange.x, _speedRange.y);
}
private void LateUpdate()
{
transform.Translate(Vector3.right * _speed * Time.deltaTime);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ea3f51bb4cd6c8146a185362df2fe451
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: