public void Awake() { if (AS_SniperKit.Environment != null) { WindSpeed = AS_SniperKit.Environment.WindSpeed; } rigidBodyComp = GetComponent <Rigidbody>(); targetLocked = null; initialPosition = this.gameObject.transform.position; AS_ActionCamera actioncam = (AS_ActionCamera)GameObject.FindObjectOfType(typeof(AS_ActionCamera)); if (actioncam != null) { actionPreset = actioncam.GetPresets(); if (actionPreset != null) { actionPreset.Shoot(this.gameObject); } } if (this.GetComponent <Renderer>()) { this.GetComponent <Renderer>().enabled = true; } }
void Awake() { if (!RootObject) { RootObject = this.transform.root.gameObject; } ActionCam = GameObject.FindWithTag("ActionCam").GetComponent <AS_ActionCamera>(); }
public void Awake() { initialPosition = this.gameObject.transform.position; AS_ActionCamera actioncam = (AS_ActionCamera)GameObject.FindObjectOfType(typeof(AS_ActionCamera)); if (actioncam != null) { actionPreset = actioncam.GetPresets(); if (actionPreset != null) { actionPreset.Shoot(this.gameObject); } } this.GetComponent <Renderer>().enabled = true; }
void Start() { actioncam = (AS_ActionCamera)GameObject.FindObjectOfType(typeof(AS_ActionCamera)); }
public void Initialize() { ActionCam = (AS_ActionCamera)FindObjectOfType(typeof(AS_ActionCamera)); }
public void Initialize() { ActionCam = (AS_ActionCamera)FindObjectOfType (typeof(AS_ActionCamera)); }
protected virtual void OnEnable() { StartCoroutine(DelayedEnable()); //The following code relies on the fact that in the canvas, //the Ui panels are named in the following format: //pSniperMode, which has children --> pStandard, pScope, and pBoth, in that order //For example: panel has children pStandard, pScope, and pBoth CurrentSniperPanel.SetActive(true); BothPanel.SetActive(true); if (txtSniperMode) { txtSniperMode.text = DisplayName; } //For zoom slider if (sldZoom) { sldZoom.minValue = MinZoom; sldZoom.maxValue = MaxZoom; sldZoom.value = sldZoom.maxValue; } if (ScopeRenderUI) { ScopeRenderUI.SetActive(false); } xRot = Root.transform.eulerAngles.x; yRot = Root.transform.eulerAngles.y; ScopeCamera.fieldOfView = MaxZoom; variableMessages = new Dictionary <string, string>(); variableTexts = new Dictionary <string, Text>(); isReloading = false; isMiniReloading = false; isInInstinctMode = false; //For thermals if (startLightColor == default(Color)) { if (GameObject.FindWithTag("Light")) { startLightColor = GameObject.FindWithTag("Light").GetComponent <Light>().color; } } else { if (GameObject.FindWithTag("Light")) { GameObject.FindWithTag("Light").GetComponent <Light>().color = startLightColor; } } if (startSkybox == null) { startSkybox = RenderSettings.skybox; } else { RenderSettings.skybox = startSkybox; } //reset bullet speed mult bulletSpeedMultiplier = 1; //Reset bullet damage if (BulletPrefab.GetComponent <Bullet>()) { BulletDamage = BulletPrefab.GetComponent <Bullet>().Strength; } initBulletDamage = BulletDamage; //Reset recoil time recoilTime = 0; InTimeFreezeMode = false; InBulletCam = false; //For special bullet vfx ActionCam = GameObject.FindWithTag("ActionCam").GetComponent <AS_ActionCamera>(); ActionCam.BeginAction += OnActionCamBegin; ActionCam.EndAction += OnActionCamEnd; ViewingScope = false; //Update the handmode property SniperPrimaryHand = PrimaryHandMode; }