示例#1
0
        /// <summary>
        /// Get the associated Viewer of these IHardwareProxy
        /// the viewer allow the user to interact with or tweak the hardware.
        /// you can return null.
        /// </summary>
        /// <returns></returns>
        public Control GetViewer()
        {
            // hey why not use the default build in Laser Viewer to let the user play with the lasers? ;)
            LaserControl view = new LaserControl();

            view.Proxy = this;
            return(view);
        }
    void OnTriggerEnter2D(Collider2D collider)
    {
        LaserControl projectile = collider.gameObject.GetComponent <LaserControl> ();

        if (projectile)           //projectile != null
        {
            Debug.Log("Hit by a projectile");
            health -= projectile.Hit();
            if (health <= 0)
            {
                Die();
            }
        }
    }
示例#3
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        LaserControl projectile = collider.gameObject.GetComponent <LaserControl> ();

        if (projectile)           //projectile != null
        {
            Debug.Log("Hit by a projectile");
            health -= projectile.Hit();
            if (health <= 0)
            {
                AudioSource.PlayClipAtPoint(deathSound, transform.position, 1f);
                SmokeWhenDie();
                Destroy(gameObject);
                scoreKeeper.Score(scoreValue);
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        player = transform.root.GetComponentInChildren <Player>();
        pickup_object_script = player.GetComponent <PickupObject>();

        pointer       = GameObject.Find("PointerRoot").transform;
        pointer_stick = GameObject.Find("Pointer_stick").gameObject;
        line          = pointer_stick.GetComponent <LineRenderer>();

        if (!Settings.debug)
        {
            GameObject.Find("Pointer").renderer.enabled = false;
            pointer_stick.renderer.enabled = false;
        }

        laser = GameObject.Find("laserDot").gameObject.GetComponent <LaserControl>();
        pbox  = GameObject.Find("Pointer").transform;
    }
示例#5
0
 // Use this for initialization
 void Start()
 {
     selectKnifeKey   = KeyCode.Alpha1;
     selectLaserKey   = KeyCode.Alpha2;
     selectGrenadeKey = KeyCode.Alpha3;
     selectTrapKey    = KeyCode.Alpha4;
     fpc = GetComponentInParent <FirstPersonController>();
     weaponAndAmmoManager = GetComponentInParent <WeaponAndAmmoManager>();
     trapControl          = GetComponent <TrapControl>();
     laserControl         = GetComponent <LaserControl>();
     grenadeControl       = GetComponent <GrenadeControl>();
     knifeControl         = GetComponent <KnifeControl>();
     cameragunControl     = GetComponent <CameragunControl>();
     playerCanvasUpdater  = GetComponentInParent <PlayerCanvasUpdater>();
     // trapControl.enabled = false;
     // laserControl.enabled = false;
     // grenadeControl.enabled = false;
     // knifeControl.enabled = false;
 }
示例#6
0
 private void OnIdle(object sender, EventArgs e)
 {
     try
     {
         bool ignore = false;
         if (!ignore && Visible)
         {
             DateTime now     = DateTime.Now;
             bool     expired = (now - lastImageTime).TotalMilliseconds > 10;
             if (expired)
             {
                 ICameraProxy camera = Settings.Get <ICameraProxy>();
                 if (camera != null)
                 {
                     CurrentImage  = camera.AcquireImage();
                     lastImageTime = now;
                     ViewPanel.Invalidate();
                 }
                 else
                 {
                     bool lasthasImage = CurrentImage != null;
                     CurrentImage = null;
                     if (lasthasImage)
                     {
                         ViewPanel.Invalidate();
                     }
                 }
                 ILaserProxy laser = Settings.Get <ILaserProxy>();
                 expired = (now - lastImageTime).TotalMilliseconds > 750;
                 if (laser != null)
                 {
                     LaserControl.Proxy = laser;
                     LaserControl.AlignControls();
                 }
             }
         }
     }
     catch
     {
     }
 }
示例#7
0
 // Use this for initialization
 void Start()
 {
     lc = laser.GetComponent <LaserControl>();
 }
    // Use this for initialization
    void Start()
    {
        player = transform.root.GetComponentInChildren<Player>();
        pickup_object_script = player.GetComponent<PickupObject>();

        pointer = GameObject.Find("PointerRoot").transform;
        pointer_stick = GameObject.Find("Pointer_stick").gameObject;
        line = pointer_stick.GetComponent<LineRenderer>();

        if(!Settings.debug)
        {
            GameObject.Find("Pointer").renderer.enabled = false;
            pointer_stick.renderer.enabled = false;
        }

        laser = GameObject.Find ("laserDot").gameObject.GetComponent<LaserControl>();
        pbox = GameObject.Find("Pointer").transform;
    }
示例#9
0
 public void AddPoolControl(LaserControl pc) => controls.Add(pc);