-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTargetPos3.cs
More file actions
55 lines (48 loc) · 1.59 KB
/
TargetPos3.cs
File metadata and controls
55 lines (48 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Animations;
public class TargetPos3 : MonoBehaviour {
GameObject root2_object;
root2 root2_script;
GameObject root1_object;
root1 root1_script;
GameObject Floor_object;
Floor Floor_script;
public float pos_x;
public float pos_y;
public float pos_z;
void Start(){
root2_object = GameObject.Find("root2");
root2_script = root2_object.GetComponent<root2>();
root1_object = GameObject.Find("root1");
root1_script = root1_object.GetComponent<root1>();
Floor_object = GameObject.Find("floor1");
Floor_script = Floor_object.GetComponent<Floor>();
pos_x = transform.position.x;
pos_y = transform.position.y;
pos_z = transform.position.z;
Vector3 pos = transform.position;
pos.x = slider.sld_x1;
pos.z = slider.sld_y1;
transform.position = pos;
}
void Update(){
if (Floor_script.work_times == 3) {
if (Floor_script.work_state == true && root2_script.catch_state == true && root1_script.catch_state == true){
this.GetComponent<RotationConstraint>().enabled = true;
this.GetComponent<PositionConstraint>().enabled = true;
// transform.parent = GameObject.Find("Cube").transform
;
}
if (root2_script.catch_state == false || (root2_script.put_state == true && root1_script.put_state == true)){
this.GetComponent<RotationConstraint>().enabled = false;
this.GetComponent<PositionConstraint>().enabled = false;
//transform.parent = null;
}
}
pos_x = transform.position.x;
pos_y = transform.position.y;
pos_z = transform.position.z;
}
}