forked from asanfilov/MobApps-An-Dz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.cs
91 lines (51 loc) · 1.78 KB
/
example.cs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System.Collections;
using UnityEngine;
using System.Collections.Generic;
public class example : MonoBehaviour {
//public GameObject horseObject;
//public GameObject pearObject;
//public GameObject pear1Object;
//public GameObject appleObject;
//public GameObject gameObject;
//private Vector3 horseposition = new Vector3();
public string foodType = "Fruits";
public Vector3 pos;
public Vector3 pos1;
public Vector3 pos2;
public Vector3 pos3;
private float dist;
private float dist1;
//public Transform target;
//public float speed;
//public Transform Apple;
//public Dictionary weapons = new Dictionary();
// Use this for initialization
void Start () {
//horseposition = GameObject.FindGameObjectWithTag("horse").transform.position;
pos= GameObject.FindGameObjectWithTag ("horse").transform.position;
pos1 = GameObject.FindGameObjectWithTag ("fruit_pear").transform.position;
pos2 = GameObject.FindGameObjectWithTag ("fruit_pear1").transform.position;
pos3 = GameObject.FindGameObjectWithTag ("apple").transform.position;
}
// Update is called once per frame
void Update () {
//gob.transform.position = Vector3.up * Time.deltaTime;
//Debug.Log (transform.position);
//horseposition = horseObject.transform.position.x;
dist = Vector3.Distance(pos, pos1);
dist1 = Vector3.Distance (pos, pos2);
//Debug.Log("dist is " + dist );
Debug.Log ("pos is " + pos);
//float step = speed * Time.deltaTime;
//transform.position = Vector3.MoveTowards(transform.position, target.position, step);
}
//void DoAIBehaviour () {
//Debug.Log ("example::DoAIBehaviour");
//}
//void Example() {
//if (Apple) {
//float dist = Vector3.Distance(Apple.position, transform.position);
//print("Distance to Apple: " + dist);
//}
//}
}