blob: f5588cd3feb307f296ef731428c936e6f416b102 (
plain)
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
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 回旋镖
/// </summary>
public class Weapon_Boomerang : WeaponBase
{
public override AutoMode autoMode => AutoMode.Condition;
public override string name => "回旋镖";
public override string iconPath => "art/ui/weaponicon/boomerang";
string prefabPath = "prefabs/weapon/boomerang";
Boomerang boomerang;
/// 接到回旋镖后重新掷出,否则间隔一段时间投掷
/// </summary>
/// <param name="owner"></param>
/// <returns></returns>
public override bool CheckCondition(GameObject owner)
{
return true;
}
public override void OnInitialize(GameObject owner)
{
base.OnInitialize(owner);
boomerang = null;
}
public override void OnTrigger(GameObject owner)
{
if (boomerang == null)
{
boomerang = UnityEngine.Object.Instantiate<Boomerang>(ResourceManager.Instance.Load<Boomerang>(prefabPath));
CrewScript crew = owner.GetComponent<CrewScript>();
Vector3 pos = crew.centre.position + new Vector3(crew.aimDirection.x, crew.aimDirection.y, 0) * 0.3f;
boomerang.transform.position = pos;
boomerang.Set(crew.aimDirection, 10f, 10f);
}
}
public override void OnStop(GameObject owner)
{
}
public override void Update(GameObject owner)
{
}
}
|