예제 #1
0
        private void UpdateGapDistance()
        {
            if (CurrentResult != null)
            {
                CurrentResult.GapDistance = GapDistance;
            }

            RBSK rbsk = MouseService.GetStandardMouseRules();

            rbsk.Settings.GapDistance     = GapDistance;
            rbsk.Settings.BinaryThreshold = BinaryThreshold;
            PointF[] result = RBSKService.RBSK(CurrentImage, rbsk);
            using (Image <Bgr, Byte> img = CurrentImage.Clone())
            {
                img.DrawPolyline(MotionTrack.Select(x => x.ToPoint()).ToArray(), false, new Bgr(Color.Blue), 2);

                if (result != null)
                {
                    foreach (PointF point in result)
                    {
                        img.Draw(new CircleF(point, 2), new Bgr(Color.Yellow), 2);
                    }
                }

                DisplayImage = ImageService.ToBitmapSource(img);
            }
        }
예제 #2
0
    //--------------------------------------------------

    public MissileL(GameObject flyObject, MotionTrack trackMode)
    {
        _mGameObject      = flyObject;
        _mMotionTrackMode = trackMode;
        _mGameObject.transform.Rotate(_mMotionTrackMode.MEulerAngle);
        if (_mGameObject.name == "S_TorpedoFly(Clone)")
        {
            Debug.Log("S_TorpedoFly");
        }
        Initialize();
    }
예제 #3
0
        public ITrack CreateTimeline()
        {
            var root = new GroupTrack {
                Name = "root"
            };

            // root直下のenabledなTrack
            var enabledMotion = new MotionTrack {
                Name = "enabled motion track"
            };

            root.Add(enabledMotion);

            // root直下のdisabledなTrack
            var disabledMotion = new MotionTrack {
                Name = "disabled motion track", IsEnabled = false
            };

            root.Add(disabledMotion);

            // rootの下のGroupTrack
            var group = new GroupTrack {
                Name = "group"
            };

            root.Add(group);

            var groupMotion_1 = new MotionTrack {
                Name = "motion track in group 1"
            };

            group.Add(groupMotion_1);

            var groupMotion_2 = new MotionTrack {
                Name = "motion track in group 2"
            };

            group.Add(groupMotion_2);

            return(root);
        }
예제 #4
0
        private void UpdateDisplayImage()
        {
            using (Image <Bgr, Byte> img = CurrentImage.Clone())
            {
                img.DrawPolyline(MotionTrack.Select(x => x.ToPoint()).ToArray(), false, new Bgr(Color.Blue), 2);
                img.DrawPolyline(CentroidMotionTrack.Select(x => x.ToPoint()).ToArray(), false, new Bgr(Color.Yellow), 2);

                if (SliderValue >= AnalyseStart && SliderValue <= AnalyseEnd)
                {
                    ISingleFrameResult frame = CurrentResult.Results[SliderValue];

                    if (!frame.HeadPoint.IsEmpty)
                    {
                        img.Draw(new CircleF(frame.HeadPoint, 2), new Bgr(Color.Red), 2);
                        img.Draw(new CircleF(frame.Centroid, 2), new Bgr(Color.Red), 2);
                    }
                }

                DisplayImage = ImageService.ToBitmapSource(img);
            }
        }
예제 #5
0
        public ITrackedVideo GetData()
        {
            ITrackedVideo trackedVideo = ModelResolver.Resolve <ITrackedVideo>();

            trackedVideo.FileName     = FileName;
            trackedVideo.Result       = Result;
            trackedVideo.SmoothMotion = SmoothMotion;
            //trackedVideo.SmoothFactor = SmoothFactor;
            trackedVideo.FrameRate         = FrameRate;
            trackedVideo.CentroidSize      = CentroidSize;
            trackedVideo.PelvicArea1       = PelvicArea1;
            trackedVideo.PelvicArea2       = PelvicArea2;
            trackedVideo.PelvicArea3       = PelvicArea3;
            trackedVideo.PelvicArea4       = PelvicArea4;
            trackedVideo.UnitsToMilimeters = UnitsToMilimeters;
            trackedVideo.Message           = Message;

            if (Results != null)
            {
                Dictionary <int, SingleFrameResultXml> headPoints   = Results.GetData();
                Dictionary <int, ISingleFrameResult>   finalResults = new Dictionary <int, ISingleFrameResult>();

                foreach (var entry in headPoints)
                {
                    int key = entry.Key;
                    SingleFrameResultXml currentEntry = entry.Value;

                    if (currentEntry == null)
                    {
                        finalResults.Add(key, null);
                    }
                    else
                    {
                        finalResults.Add(key, currentEntry.GetData());
                    }
                }

                trackedVideo.Results = finalResults;
            }

            //if (WaistSizes != null)
            //{
            //    trackedVideo.WaistSizes = WaistSizes.GetData();
            //}

            if (MotionTrack != null)
            {
                trackedVideo.MotionTrack = MotionTrack.Select(x => x.GetPoint()).ToArray();
            }

            if (SmoothedMotionTrack != null)
            {
                trackedVideo.SmoothedMotionTrack = SmoothedMotionTrack.Select(x => x.GetPoint()).ToArray();
            }

            if (OrientationTrack != null)
            {
                trackedVideo.OrientationTrack = OrientationTrack.Select(x => x.GetVector()).ToArray();
            }

            if (Boundries != null)
            {
                trackedVideo.Boundries = Boundries.Select(x => x.GetBoundary()).ToArray();
            }

            if (Events != null)
            {
                trackedVideo.Events = Events.Select(x => x.GetData()).ToArray();
            }

            if (InteractingBoundries != null)
            {
                trackedVideo.InteractingBoundries = InteractingBoundries.GetData().ToDictionary(kvp => kvp.Key.GetBoundary(), kvp => kvp.Value.Select(x => x.GetData()).ToArray());
            }

            trackedVideo.MinInteractionDistance = MinInteractionDistance;
            trackedVideo.GapDistance            = GapDistance;
            trackedVideo.ThresholdValue         = ThresholdValue;
            trackedVideo.ThresholdValue2        = ThresholdValue2;
            trackedVideo.StartFrame             = StartFrame;
            trackedVideo.EndFrame          = EndFrame;
            trackedVideo.UnitsToMilimeters = UnitsToMilimeters;

            trackedVideo.UpdateTrack();
            return(trackedVideo);
        }
예제 #6
0
    public virtual void CreateFlyParticle()
    {
        bool isCreate = false;

        foreach (SkillEffectData.SkillFlyParticleData flyParticleData in _mSkillDataSlot._skillEffectData._skillFlyParticleList)
        {
            if (_mCurrentTrackTime >= flyParticleData._delayTime)
            {
                // tzz added for null
                if (_mSkillUser.U3DGameObject == null)
                {
                    continue;
                }

                // Play fly sound
                if (null != flyParticleData._skillSound)
                {
                    Debug.Log("_mSkillUser " + _mSkillUser.U3DGameObject.name + "Sound " + flyParticleData._skillSound._soundName);
                    Globals.Instance.MSoundManager.PlaySoundEffect(flyParticleData._skillSound._soundName);
                }

                Vector3 startPosition = _mSkillUser.U3DGameObject.transform.position;

                // Create multiple missile effects
                foreach (SkillDataSlot.AttackTargetData attackTargetData in _mSkillDataSlot._attackTargetDataList.Values)
                {
                    UnityEngine.Object obj = Resources.Load(flyParticleData._particleName);
                    if (null == obj)
                    {
                        isCreate = true;
                        Debug.Log("[Skill]: Cann't find the fly effect name " + flyParticleData._particleName);
                        continue;
                    }

                    // Calculate the Projectile ParticleEffect information
                    GameObject go = GameObject.Instantiate(obj, Vector3.zero, Quaternion.identity) as GameObject;

                    WarshipL target      = Globals.Instance.MPlayerManager.GetWarship(attackTargetData._targetID);
                    Vector3  endPosition = target.U3DGameObject.transform.position;

                    float missileHorzSpeed = flyParticleData.speed;
                    float targetHorzSpeed  = target.MoveSpeed;
                    if (attackTargetData._moveState == (int)GameData.BattleGameData.MoveState.STOP)
                    {
                        targetHorzSpeed = 0.0f;
                    }

                    MotionTrack motionTrack = null;
                    // Lihaojie 2012.09.26 Add a time track model, solve the problem which caused by the cure skill and damage skill order
                    if (_mSkillDataSlot.IsCureSkill())
                    {
                        motionTrack = new TimeTrack(GameDefines.BATTLE_STEP_TIME - flyParticleData._delayTime - 0.05f);
                    }
                    else
                    {
                        switch ((EWarshipType)_mSkillUser.Property.WarshipType)
                        {
                        case EWarshipType.CARRIER:
                        {
                            startPosition.y += 50.0f;
                            endPosition.y   += 50.0f;
                            // missileHorzSpeed = 150;
                            motionTrack = new AirCraftTrack(startPosition, endPosition, missileHorzSpeed, targetHorzSpeed);
                            break;
                        }

                        case EWarshipType.SUBMARINE:
                        {
                            motionTrack = new  LineTrack(startPosition, endPosition, missileHorzSpeed, targetHorzSpeed);
                            break;
                        }

                        case EWarshipType.SURFACE_SHIP:
                        {
                            // Assume the two speed is in x axis
                            float gravityAcceleration = -100.0f;

                            // MotionTrack motionTrack = new ParabolicTrack(startPosition, endPosition, horzSpeed);
                            motionTrack = new ParabolicTrack(startPosition, endPosition, missileHorzSpeed, targetHorzSpeed, gravityAcceleration);
                            break;
                        }
                        }
                    }

                    MissileL missile = new MissileL(go, motionTrack);
                    _mMissileEffectList.Add(missile);
                    _mFlyEffectObjs.Add(go);

                    isCreate     = true;
                    _mSkillState = SkillState.FLY;
                }                 // End foreach
            }
        }

        _mIsFlyParticleCreated = isCreate;
    }
예제 #7
0
    public override void CreateFlyParticle()
    {
        // tzz modified for enemy NiVose fly particle
        //
//		if (!_mSkillUser.Property.WarshipIsAttacker)
//		{
//			base.CreateFlyParticle();
//
//			// tzz modified for creating fly state
//			//
//			if(_mIsFlyParticleCreated){
//				_mSkillState = SkillState.FLY;
//			}
//			return;
//		}

        bool isCreate = false;

        foreach (SkillEffectData.SkillFlyParticleData flyParticleData in _mSkillDataSlot._skillEffectData._skillFlyParticleList)
        {
            if (_mCurrentTrackTime >= flyParticleData._delayTime)
            {
                if (null != flyParticleData._skillSound)
                {
                    Globals.Instance.MSoundManager.PlaySoundEffect(flyParticleData._skillSound._soundName);
                }

                WarshipL skillUser     = Globals.Instance.MPlayerManager.GetWarship(_mSkillDataSlot._attackerID);
                Vector3  startPosition = skillUser.U3DGameObject.transform.position;

                // Create multiple missile effects
                foreach (SkillDataSlot.AttackTargetData attackTargetData in _mSkillDataSlot._attackTargetDataList.Values)
                {
                    string effectName = flyParticleData._particleName;
                    if (_mSkillUser.Property.WarshipIsAttacker)
                    {
                        effectName = flyParticleData._particleName + "_L";
                    }
                    else
                    {
                        effectName = flyParticleData._particleName + "_R";
                    }

                    // Calculate the Projectile ParticleEffect information
                    GameObject go = GameObject.Instantiate(Resources.Load(effectName),
                                                           Vector3.zero, Quaternion.identity) as GameObject;
                    if (null == go)
                    {
                        Debug.Log("The effect resource " + effectName + "is not found");
                        continue;
                    }

                    WarshipL target      = Globals.Instance.MPlayerManager.GetWarship(attackTargetData._targetID);
                    Vector3  endPosition = target.U3DGameObject.transform.position;

                    float missileHorzSpeed = flyParticleData.speed;
                    float targetHorzSpeed  = target.MoveSpeed;
                    if (attackTargetData._moveState == (int)GameData.BattleGameData.MoveState.STOP)
                    {
                        targetHorzSpeed = 0.0f;
                    }

                    MotionTrack motionTrack = null;

                    startPosition.y += 50.0f;
                    endPosition.y   += 50.0f;

                    // missileHorzSpeed = 150;
                    go.transform.position = startPosition;
                    motionTrack           = new AirCraftTrack(startPosition, endPosition, missileHorzSpeed, targetHorzSpeed);

                    MissileL missile = new MissileL(go, motionTrack);
                    _mMissileEffectList.Add(missile);
                    _mFlyEffectObjs.Add(go);

                    isCreate     = true;
                    _mSkillState = SkillState.FLY;
                    break;
                }                 // End foreach
            }
        }

        _mIsFlyParticleCreated = isCreate;
    }