/// <summary> /// Set all sniper primary hands to left handed, if provided argument is true /// </summary> public void SetPrimaryHand(bool isLeftHanded) { foreach (SniperController sc in GameObject.Find("Snipers").transform.GetComponentsInChildren <SniperController>(true)) { if (isLeftHanded) { sc.PrimaryHandMode = PrimaryHand.LeftHanded; } else { sc.PrimaryHandMode = PrimaryHand.RightHanded; } } //Also swap the back button's position SniperController.FlipRectTransform(transform.parent.parent.GetChild(0).GetComponent <RectTransform>()); }
// Use this for initialization void OnEnable() { Alive = true; controller = GetComponent <CharacterController>(); //Create a random object with the instance id as the seed to avoid duplicate random objects rand = new System.Random(gameObject.GetInstanceID()); velocity = GetRandomUnitVector(); sniper = GameObject.FindWithTag("Player").GetComponent <SniperController>(); if (startPos == Vector3.zero) { startPos = transform.position; } else { transform.position = startPos; } if (initHealth == 0) { initHealth = Health; } else { Health = initHealth; } initHudText = HUDGraphic.GetComponent <TextMesh>().text; //Hide the exclamation point HUDGraphic.GetComponent <Renderer>().enabled = false; //subscribe to events sniper.TimeFreeze += HandleTimeFreeze; sniper.BulletCamEvent += HandleBulletCam; sniper.PowerupBegin += HandlePowerupBegin; sniper.PowerupEnd += HandlePowerupEnd; sniper.InstinctBegin += HandleInstinctBegin; sniper.InstinctEnd += HandleInstinctEnd; StartCoroutine(EnableDelay()); }
protected virtual void Start() { controller = new SniperController(this); }
protected virtual void Start () { controller = new SniperController (this); }
private void Start() { sniper = GameObject.FindWithTag("Player").GetComponent <SniperController>(); }