Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class InteractionController : MonoBehaviour
- {
- public bool InteractionTrue;
- public bool Icon;
- public float speed;
- public GameObject IconGame;
- public Transform Point1;
- public Transform Point2;
- // Use this for initialization
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- float step = speed * Time.deltaTime;
- if (Icon == true)
- {
- IconGame.SetActive(true);
- Icon = false;
- }
- else
- {
- IconGame.SetActive(false);
- }
- if (InteractionTrue == true)
- {
- gameObject.transform.position = Vector3.MoveTowards(transform.position, Point2.position, step);
- }
- else
- {
- gameObject.transform.position = Vector3.MoveTowards(transform.position, Point1.position, step);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement