Nextrek
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
|
/*
*
* Adventure Creator
* by Chris Burton, 2013-2014
*
* "NavMeshSegment.cs"
*
* This script is used for the NavMeshSegment prefab, which defines
* the area to be baked by the Unity Navigation window.
*
*/
using UnityEngine;
using System.Collections;
using AC;
public class NavMeshSegment : MonoBehaviour
{
private SceneSettings sceneSettings;
private void Awake ()
{
Hide ();
if (GameObject.FindWithTag (Tags.gameEngine) && GameObject.FindWithTag (Tags.gameEngine).GetComponent <SceneSettings>())
{
sceneSettings = GameObject.FindWithTag (Tags.gameEngine).GetComponent <SceneSettings>();
if (sceneSettings.navigationMethod == AC_NavigationMethod.UnityNavigation)
{
if (LayerMask.NameToLayer (AdvGame.GetReferences ().settingsManager.navMeshLayer) == -1)
{
Debug.LogWarning ("No 'NavMesh' layer exists - please define one in the Tags Manager.");
}
else
{
gameObject.layer = LayerMask.NameToLayer (AdvGame.GetReferences ().settingsManager.navMeshLayer);
}
}
}
}
public void Hide ()
{
if (this.GetComponent <MeshRenderer>())
{
this.GetComponent <MeshRenderer>().enabled = false;
}
}
public void Show ()
{
if (this.GetComponent <MeshRenderer>() && this.GetComponent <MeshFilter>() && this.GetComponent <MeshCollider>() && this.GetComponent <MeshCollider>().sharedMesh)
{
this.GetComponent <MeshFilter>().mesh = this.GetComponent <MeshCollider>().sharedMesh;
this.GetComponent <MeshRenderer>().enabled = true;
this.GetComponent <MeshRenderer>().castShadows = false;
this.GetComponent <MeshRenderer>().receiveShadows = false;
}
}
}
|
Revision |
Author |
Commited |
Message |
83
|
FMMortaroli
|
Tue 13 May, 2014 11:32:51 +0000 |
|