LoadNPC.cs
1.13 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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LoadNPC : MonoBehaviour
{
private GameObject mainCamera;
public GameObject npcPrefab;
int load_count = 0;
public float distance;
public Vector3 npc_look1;
public Vector3 npc_look2;
// Start is called before the first frame update
public Vector3 position;
bool npc1_destroy = false;
void start()
{
}
// Update is called once per frame
void Update()
{
if (load_count < 2)
{
GameObject npc1 = Instantiate(npcPrefab, new Vector3(position.x - distance, position.y, position.z), new Quaternion(0, 0, 0, 0)) as GameObject;
npc1.transform.LookAt(npc_look1);
npc1.GetComponent<TargetEdited>().npc_no = 1;
load_count++;
GameObject npc2 = Instantiate(npcPrefab, new Vector3(position.x + distance, position.y, position.z), new Quaternion(0, 0, 0, 0)) as GameObject;
npc2.transform.LookAt(npc_look2);
npc2.GetComponent<TargetEdited>().npc_no = 2;
load_count++;
}
}
}