You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
723 B
33 lines
723 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class HS_FrontMover : MonoBehaviour
|
|
{
|
|
public Transform pivot;
|
|
public ParticleSystem effect;
|
|
public float speed = 15f;
|
|
public float drug = 1f;
|
|
public float repeatingTime = 1f;
|
|
|
|
private float startSpeed = 0f;
|
|
|
|
void Start()
|
|
{
|
|
InvokeRepeating("StartAgain", 0f, repeatingTime);
|
|
effect.Play();
|
|
startSpeed = speed;
|
|
}
|
|
|
|
void StartAgain()
|
|
{
|
|
startSpeed = speed;
|
|
transform.position = pivot.position;
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
startSpeed = startSpeed * drug;
|
|
transform.position += transform.forward * (startSpeed * Time.deltaTime);
|
|
}
|
|
}
|