1. Test
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
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test : MonoBehaviour
{
public TestHero testHero;
public float speed;
public GameObject ball;
private float time;
private float x;
private float z;
public GameObject empty;
// Start is called before the first frame update
void Start()
{
}
void Update()
{
Vector3 dir = this.empty.transform.position;
this.time = Time.deltaTime;
float speed = 30f;
this.empty.transform.Rotate(Vector3.up * time * speed);
var forward = this.empty.transform.forward;
this.ball.transform.position = forward + dir;
this.testHero.transform.Translate(Time.deltaTime * Vector3.forward * 1f);
this.empty.transform.position = this.testHero.transform.position;
//this.ball.transform.RotateAround(dir, Vector3.up, time*100);
}
}
|
2. TestHero
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TestHero : MonoBehaviour
{
public GameObject model;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
|
'C# > 수업내용' 카테고리의 다른 글
2020.05.14. 수업내용 - Scene 전환 후 스테이지 클리어하기(ObjectPool) 미완성 (0) | 2020.05.15 |
---|---|
2020.05.13. 수업내용 - 버튼 누르면 무기, 이펙트, 아이콘 바뀌기(Json Data) (0) | 2020.05.13 |
2020.05.12. 수업내용 - 생성된 캐릭터가 서로 달려와서 공격하기(상속) (0) | 2020.05.12 |
2020.05.11 수업내용 - Scene 변환 (0) | 2020.05.11 |
2020.05.08. 수업내용 - Unity Monobehaviour LifeCycle (0) | 2020.05.10 |