protected override void Activate()
    {
        GameObject      obj = Instantiate(projectile, gameObject.transform.position + new Vector3(0f, 2f, 0f), new Quaternion());
        HorizontalSwipe pbh = obj.GetComponent <HorizontalSwipe>();

        obj.transform.LookAt(mpd.CalculateWorldPosition());
        var lookPos = mpd.CalculateWorldPosition() - transform.position;

        lookPos.y = 0;
        var rotation = Quaternion.LookRotation(lookPos);

        obj.transform.localScale = new Vector3(5f, 5f, 5f);
        pbh.speed = projSpeed;
        Damage dmg = new Damage(0f, Random.Range(dmgMin, dmgMax), false, false, true);

        pbh.dmg = stats.RealDamage(dmg);
        TimedBuff tb   = slowdown.Instance;
        Stat      stat = tb.Stats.Find(item => item.Name == Stat.MOVE_SPEED_MULT);

        // Debug.Log("just like the white winged dove : " + stat.Name + stat.Value + slowdownMult);
        stat = new Stat(stat.Name, StatBlock.CalcMult(stat.Value, slowdownMult));
        tb.Stats.Remove(new Stat(Stat.MOVE_SPEED_MULT));
        tb.Stats.Add(stat);
        tb.Duration += slowdownDur;
        tb.IsUnique  = !slowdownStack;
        pbh.dmg.buffs.Add(tb);
        pbh.friendly = true;
        pbh.ttl      = 4000f;
        pbh.player   = gameObject;
    }
示例#2
0
        public KinectService()
        {
            try
            {
                this.runtime = new Runtime();
                this.runtime.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(runtime_DepthFrameReady);
                this.runtime.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(
                    runtime_SkeletonFrameReady);
                this.runtime.Initialize(RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseDepthAndPlayerIndex);
                runtime.DepthStream.Open(
                    ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex);
                this.initialized = true;

                this.swipe = new HorizontalSwipe();
                this.swipe.SwipeCaptured += new EventHandler<SwipeEventArgs>(swipe_SwipeCaptured);
            }
            catch (InvalidOperationException opEx)
            {
                MessageBox.Show("Kinect no worky: " + opEx.ToString());
                // s'ok
            }
        }