Advertisement
Guest User

Untitled

a guest
Oct 21st, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class BossVelocity : MonoBehaviour {
  6.  
  7. public float MoveSpeed = 1.5f;
  8. public static float MoveSpeedStatic = 1.5f;
  9. private float frequency = 5f; // Speed of sine movement
  10. private float magnitude = 2.5f; // Size of sine movement
  11. private Vector3 axis;
  12.  
  13. private Vector3 pos;
  14.  
  15. void Start () {
  16. pos = transform.position;
  17. axis = transform.up;
  18. }
  19.  
  20. void FixedUpdate () {
  21. pos -= transform.right * Time.deltaTime * MoveSpeed;
  22. transform.position = pos + axis * Mathf.Sin (Time.time * frequency) * magnitude;
  23. }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement