forked from Hazardu/ChampionsOfForest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrapHitMod.cs
85 lines (84 loc) · 3.08 KB
/
TrapHitMod.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
using UnityEngine;
namespace ChampionsOfForest
{
public class TrapHitMod : trapHit
{
protected override void registerTrapHit(Collider other)
{
if (other.GetComponent<creepyHitReactions>() && !this.disable && this.trigger.largeSpike)
{
this.sendCreepyDamageFromRoot(other);
if (!this.disable)
{
base.Invoke("disableCollision", 0.8f);
}
return;
}
if (other.gameObject.CompareTag("enemyCollide") || other.gameObject.CompareTag("playerHitDetect") || other.gameObject.CompareTag("Player") || other.gameObject.CompareTag("animalCollide"))
{
if (other.gameObject.CompareTag("enemyCollide"))
{
mutantHitReceiver component = other.transform.GetComponent<mutantHitReceiver>();
if (component && component.inNooseTrap)
{
return;
}
explodeDummy component2 = other.GetComponent<explodeDummy>();
if (component2)
{
return;
}
}
if (!this.disable)
{
if (this.trigger.largeSpike)
{
other.gameObject.SendMessageUpwards("setTrapLookat", base.transform.root.gameObject, SendMessageOptions.DontRequireReceiver);
base.gameObject.SendMessage("addTrappedMutant", other.transform.root.gameObject, SendMessageOptions.DontRequireReceiver);
other.gameObject.SendMessageUpwards("setCurrentTrap", this.trigger.gameObject, SendMessageOptions.DontRequireReceiver);
this.sendCreepyDamage(other);
if (other.gameObject.CompareTag("Player"))
{
other.gameObject.SendMessage("HitFromTrap", 150, SendMessageOptions.DontRequireReceiver);
}
}
else if (this.trigger.largeDeadfall)
{
if (other.gameObject.CompareTag("playerHitDetect"))
{
other.gameObject.SendMessageUpwards("HitFromTrap", 150, SendMessageOptions.DontRequireReceiver);
}
if (other.gameObject.CompareTag("enemyCollide"))
{
this.sendCreepyDamage(other);
}
}
if (this.trigger.largeSwingingRock)
{
if (this.rb.velocity.magnitude > 11f)
{
other.gameObject.SendMessageUpwards("Hit", 2000, SendMessageOptions.DontRequireReceiver);
//other.gameObject.SendMessageUpwards("Explosion", -1, SendMessageOptions.DontRequireReceiver);
//other.gameObject.SendMessage("lookAtExplosion", base.transform.position, SendMessageOptions.DontRequireReceiver);
//other.gameObject.SendMessageUpwards("DieTrap", this.trapType, SendMessageOptions.DontRequireReceiver);
}
}
else
{
other.gameObject.SendMessageUpwards("Hit", 1000, SendMessageOptions.DontRequireReceiver);
//other.gameObject.SendMessageUpwards("DieTrap", this.trapType, SendMessageOptions.DontRequireReceiver);
//if (other.gameObject.CompareTag("enemyCollide") && this.trigger.largeSpike)
//{
// Vector3 vector = this.PutOnSpikes(other.transform.root.gameObject);
// other.gameObject.SendMessageUpwards("setPositionAtSpikes", vector, SendMessageOptions.DontRequireReceiver);
//}
}
if (!this.disable && !this.trigger.largeSwingingRock)
{
base.Invoke("disableCollision", 0.8f);
}
}
}
}
}
}