Esempio n. 1
0
 /// <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>());
 }
Esempio n. 2
0
    // 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());
    }
Esempio n. 3
0
 protected virtual void Start()
 {
     controller = new SniperController(this);
 }
Esempio n. 4
0
	protected virtual void Start () {
		controller = new SniperController (this);
	}
Esempio n. 5
0
 private void Start()
 {
     sniper = GameObject.FindWithTag("Player").GetComponent <SniperController>();
 }