void Start() { for (int i = 0; i < crosshairs.Length; i++) { crosshairs[i].gameObject.SetActive(false); } crosshairs[index].gameObject.SetActive(true); activeCrosshair = crosshairs[index]; }
public void DefineCrosshairByName(string name) { for (int i = 0; i < crosshairs.Length; i++) { if (string.Equals(crosshairs[i].name, name)) { activeCrosshair = crosshairs[i]; break; } } }
// Use this for initialization void Start() { crosshairManager = CrosshairManager.GetInstance(); //Debug.Log(crosshairManager.activeCrosshair); crosshair = crosshairManager.activeCrosshair.GetComponent <Crosshair>(); camProperties = FreeCameraLook.GetInstance(); camPivot = camProperties.transform.GetChild(0); camTrans = camPivot.GetChild(0); shakeCam = camPivot.GetComponentInChildren <ShakeCamera>(); states = GetComponent <StateManager>(); shotLayerMask = ~(1 << gameObject.layer | 1 << LayerMask.NameToLayer("Enclos") | 1 << LayerMask.NameToLayer("Wolf") | 1 << LayerMask.NameToLayer("Leurre") | 1 << LayerMask.NameToLayer("Trap") | 1 << LayerMask.NameToLayer("ignoreLayer")); shotLayerMask = shotLayerMask & ~(1 << LayerMask.NameToLayer("Default")); states.shotLayerMask = shotLayerMask; camLayerMask = ~(1 << gameObject.layer | 1 << LayerMask.NameToLayer("Terrain") | 1 << LayerMask.NameToLayer("Wolf") | 1 << LayerMask.NameToLayer("Leurre") | 1 << LayerMask.NameToLayer("Trap") | 1 << LayerMask.NameToLayer("ignoreLayer")); fenceCollision = false; gameObject.AddComponent <HandleMovement_Player>(); hMove = GetComponent <HandleMovement_Player>(); player = GetComponent <Player>(); states.isPlayer = true; states.Init(); hMove.Init(states, this); player.Init(); FixPlayerMeshes(); }
public void DefineCrosshairByIndex(int findIndex) { activeCrosshair = crosshairs[findIndex]; }