private void InitBehaviourTree()
        {
            _behaviourManagerComponent     = GetComponent <BehaviourManager>();
            EnemyBehaviourTree.Root        = new BehaviourRootNode();
            EnemyBehaviourTree.WaitForTurn = new BehaviourWaitForCondition(IsEnemyTurn, 1f, 0f);
            EnemyBehaviourTree.Root.AddChild(EnemyBehaviourTree.WaitForTurn);
            EnemyBehaviourTree.SequencePlayTurn      = new BehaviourSequence(false);
            EnemyBehaviourTree.SequencePlayTurn.Name = "Play Turn";
            EnemyBehaviourTree.WaitForTurn.AddChild(EnemyBehaviourTree.SequencePlayTurn);

            EnemyBehaviourTree.ActionDoAnnounceAction = new BehaviourAction(DoAnnounceAction, "Do Announce Attack");
            EnemyBehaviourTree.SequencePlayTurn.AddChild(EnemyBehaviourTree.ActionDoAnnounceAction);

            EnemyBehaviourTree.WaitBeforeAction = new BehaviourWait(1f);
            EnemyBehaviourTree.SequencePlayTurn.AddChild(EnemyBehaviourTree.WaitBeforeAction);

            EnemyBehaviourTree.SelectorDecideAction = new BehaviourSelector(false);
            EnemyBehaviourTree.ActionDoHeal         = new BehaviourAction(DoHeal, "Do Heal");
            EnemyBehaviourTree.ActionDoHeal.OnStarted.AddListener(DoHealOnStarted_Listener);
            EnemyBehaviourTree.ConditionShouldHeal      = new BehaviourCondition(ShouldEnemyHeal, EnemyBehaviourTree.ActionDoHeal);
            EnemyBehaviourTree.ConditionShouldHeal.Name = "Should Heal";
            EnemyBehaviourTree.SelectorDecideAction.AddChild(EnemyBehaviourTree.ConditionShouldHeal);

            EnemyBehaviourTree.ActionDoAttack = new BehaviourAction(DoAttack, "Do Attack");
            EnemyBehaviourTree.ActionDoAttack.OnStarted.AddListener(DoAttackOnStarted_Listener);

            EnemyBehaviourTree.SelectorDecideAction.AddChild(EnemyBehaviourTree.ActionDoAttack);
            EnemyBehaviourTree.SequencePlayTurn.AddChild(EnemyBehaviourTree.SelectorDecideAction);
            _behaviourManagerComponent.SetCurrentTree(EnemyBehaviourTree.Root, true);
        }
예제 #2
0
 protected void InitComponents()
 {
     _botGroundComponent        = GetComponent <BotGround>();
     _behaviourManagerComponent = GetComponent <BehaviourManager>();
     _botVisionComponent        = GetComponent <BotPartVision>();
     FlagHolder = gameObject.GetChild(NAME_FLAGHOLDER);
 }
예제 #3
0
    // it is assumed the current projectile is a generic projectile with an empty reference behaviour to fill up
    public void Clone(Projectile p_projectile, ProjectileInfo p_projectileInfo, List <ProjectileBehaviour> p_extraBehaviours)
    {
        p_projectile.LoadComponents();
        LoadComponents();

        SpriteRenderer render   = m_render;
        BoxCollider2D  collider = m_boxCollider;

        render.sprite   = p_projectile.m_render.sprite;
        collider.size   = p_projectile.m_boxCollider.size;
        collider.offset = p_projectile.m_boxCollider.offset;

        // this will overwrite any assignment done to this projectile beforehand
        p_projectile.Copy(typeof(Projectile), gameObject);

        m_render           = render;
        m_boxCollider      = collider;
        m_info             = p_projectileInfo;
        m_behaviourManager = GetComponent <BehaviourManager>();
        m_behaviourManager.m_behaviours = new Dictionary <ProjectileBehaviour, bool>();

        foreach (ProjectileBehaviour behaviour in m_info.m_behaviours)
        {
            m_behaviourManager.m_behaviours.Add(behaviour, false);
        }

        foreach (ProjectileBehaviour behaviour in p_extraBehaviours)
        {
            m_behaviourManager.m_behaviours.Add(behaviour, false);
        }

        m_original = p_projectile;
    }
예제 #4
0
 public override void UpdateBehaviour(BehaviourManager manager)
 {
     if (checkBehaviour(manager))
     {
         manager.behaviours.Pop();
     }
 }
예제 #5
0
        public void InitializeServices(ContentManager c, SpriteBatch sb)
        {
            MouseHandler mouseHandle = new MouseHandler();

            registerUPDService <MouseHandler>(mouseHandle);
            KeyHandler keyHandle = new KeyHandler();

            registerUPDService <KeyHandler>(keyHandle);

            ////////////////////////////////////////////////////////////////////////
            CameraManager camManage = new CameraManager();

            camManage.Initialize();
            registerUPDService <CameraManager>(camManage);


            SoundManager soundManage = new SoundManager();

            registerService <SoundManager>(soundManage);


            IResourceLoader resource = new ResourceLoader();

            resource.Content = c;
            resource.Initialize();
            registerService <IResourceLoader>(resource);

            EntityManager entityManage = new EntityManager();

            registerService <EntityManager>(entityManage);


            BehaviourManager behaveManage = new BehaviourManager();

            registerUPDService <BehaviourManager>(behaveManage);

            DetectionManger detectManage = new DetectionManger();

            registerUPDService <DetectionManger>(detectManage);

            RenderManager render = new RenderManager();

            registerUPDService <RenderManager>(render);



            IScreenManager screenManage = new ScreenManager();

            screenManage.Initialize();
            registerService <IScreenManager>(screenManage);
            soundManage.Initialize();


            registerUPDService <IScreenManager>(screenManage);
        }
예제 #6
0
        private void UnregisterUpdateable()
        {
            BehaviourManager manager = BehaviourManager.Instance;

            if (manager != null)
            {
                manager.Remove(this);
            }
            else
            {
                Debug.LogError("Behaviour Manager not present!");
            }
        }
예제 #7
0
 public bool pathComplete(BehaviourManager manager)
 {
     if (!manager.agent.pathPending)
     {
         if (manager.agent.stoppingDistance >= manager.agent.remainingDistance)
         {
             if (!manager.agent.hasPath || manager.agent.velocity.sqrMagnitude == 0f)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        public static void Initialize()
        {
            settings = new KZ_Settings();

            devConsole = DevConsole.Create();
            devConsole.Initialize();

            behaviourManager = BehaviourManager.Create();
            behaviourManager.Initialize();

            appFlow = AppFlow.Create();
            appFlow.Inititalize();

            Debug.Log("locator initialized");
        }
예제 #9
0
        // execute current behaviour and check if we need to change it
        // also update the mood, currently uses the first mood, but in the future if you have multiple people detected you can make it follow a certain person by assigning said person an id
        private void Behaviour()
        {
            var moods = Instances.GetEmotions();

            if (moods.Count != 0)
            {
                _mood = moods[0];
                if (_nextBehaviour)
                {
                    _previousBehaviourChange = DateTime.Now;
                    _behaviour     = BehaviourManager.GetBehaviour(_mood);
                    _nextBehaviour = false;
                }
            }
            _nextBehaviour = _behaviour.Execute(this);
        }
예제 #10
0
    public MonsterAI(Monster _monster)
    {
        monster = _monster;
        aiInfo  = monster.aiInfo;
        anim    = monster.gameObject.AddComponent <Animator> ();
        anim.runtimeAnimatorController = GameObject.Instantiate <RuntimeAnimatorController> (Resources.Load("AI/BaseAI") as RuntimeAnimatorController);
        behaviourManager = new BehaviourManager(anim, this);

        //Create dictionary of state names from state machines with the functions they will call, names must match stateNames above
        stateDict = new Dictionary <string, BaseState>();
        stateDict.Add("Idle", new IdleState(monster));
        stateDict.Add("Die", new DieState(monster));
        stateDict.Add("AttackTarget", new AttackState(monster));
        stateDict.Add("Enraged", new EnragedState(monster));
        stateDict.Add("ChaseTarget", new ChaseState(monster));
        stateDict.Add("Wander", new WanderState(monster));
        stateDict.Add("Retreat", new RetreatState(monster));
    }
예제 #11
0
    // Use this for initialization
    public virtual void Start()
    {
        GameObject gameMngr = GameObject.Find("GameManager");

        if (null == gameMngr)
        {
            Debug.Log("Error in " + gameObject.name +
                      ": Requires a GameManager object in the scene.");
            Debug.Break();
        }
        position      = transform.position;
        behaviourMngr = gameMngr.GetComponent <BehaviourManager>();
        worldSize     = behaviourMngr.worldSize;

        //Check that mas is initialized to something. Mass cannot be negative
        if (mass <= 0.0f)
        {
            mass = 0.01f;
        }
    }
예제 #12
0
    public void InitUnit(EnumInfo.TeamType _tType)
    {
        _tr       = transform;
        _unitData = DataManager.Instance.GetUnitDataWithUnitIdx(_unitIdx);
        _teamType = _tType;

        _stateMgr     = GetComponentInChildren <StateManager>();
        _animMgr      = GetComponentInChildren <AnimManager>();
        _behaviourMgr = GetComponentInChildren <BehaviourManager>();
        _moveMgr      = GetComponentInChildren <MoveManager>();
        _seeker       = GetComponentInChildren <Seeker>();

        _stateMgr.InitStateMgr(this);
        _animMgr.InitAnimMgr(this);
        _behaviourMgr.InitBehaviourMgr(this);
        _moveMgr.InitMoveMgr(this);


        if (_unitData.DamageType.Equals("Physic"))
        {
            _normalDamage.Type = EnumInfo.DamageType.Physic;
        }
        else
        {
            _normalDamage.Type = EnumInfo.DamageType.Magic;
        }
        _normalDamage.DamagePower  = _unitData.Damage;
        _normalDamage.ResourceUnit = this;

        if (_unitData.SkillDamageType.Equals("Physic"))
        {
            _skillDamage.Type = EnumInfo.DamageType.Physic;
        }
        else
        {
            _skillDamage.Type = EnumInfo.DamageType.Magic;
        }

        _skillDamage.DamagePower  = _unitData.SkillDamage;
        _skillDamage.ResourceUnit = this;
    }
            private void GetGenerators()
            {
                BehaviourManager.OnFinishedInitializing -= GetGenerators;

                _generators = new Dictionary <Type, CustomIDGeneratorAttribute>();

                foreach (CustomIDGeneratorAttribute generator in BehaviourManager.GetBehaviours <CustomIDGeneratorAttribute>())
                {
                    if (_generators.ContainsKey(generator.Type))
                    {
                        if (_generators[generator.Type].Priority < generator.Priority)
                        {
                            _generators[generator.Type] = generator;
                        }
                    }
                    else
                    {
                        _generators.Add(generator.Type, generator);
                    }
                }
            }
예제 #14
0
    // Use this for initialization
    void Start()
    {
        maxSpeed = UnityEngine.Random.Range(0.01f, 0.08f);
        townhall = GameObject.Find("GameManager").GetComponent <TileManager>().Tiles[GameObject.Find("GameManager").GetComponent <TileManager>().numrows][GameObject.Find("GameManager").GetComponent <TileManager>().numcolumns].GetComponent <Tile>().Buildingattached;
        gameMngr = GameObject.Find("GameManager");
        if (null == gameMngr)
        {
            Debug.Log("Error in " + gameObject.name +
                      ": Requires a GameManager object in the scene.");
            Debug.Break();
        }
        position      = transform.position;
        behaviourMngr = gameMngr.GetComponent <BehaviourManager>();

        //Check that mas is initialized to something. Mass cannot be negative
        if (mass <= 0.0f)
        {
            mass = 0.01f;
        }
        target = townhall;
    }
        public static void Initialize()
        {
            if (HasInitialized)
            {
                return;
            }

            HasInitialized = true;

            HierarchyManager.Initialize();

            HookUpJSONReferenceHandler();
            OnSerializationStarted?.Invoke();

            AssemblyManager.Initialize();

            IDManager.Initialize();
            Converter.Initialize();
            BlockedTypes.Initialize();

            BehaviourManager.Initialize();
            AssemblyManager.ExecuteReflection();
        }
예제 #16
0
        public static IEnumerator Initialize(MonoBehaviour mono, KernelInitializeData initializeData)
        {
            MDebug.Assert(ms_IsInitialized == false, "ms_IsInitialized == false");
            ms_IsInitialized = true;
            Mono             = mono;

            MDebug.Log("Core", "Initialize kernel with date:\n" + JsonUtility.ToJson(initializeData, true));

            BehaviourManager = new GameObject("GF.Core").AddComponent <BehaviourManager>();
            yield return(null);

            ObjectPool = new ObjectPoolManager(initializeData);
            yield return(null);

            // add gf event
            if (initializeData.EventTypes == null)
            {
                initializeData.EventTypes = new List <Type>();
            }
            initializeData.EventTypes.Insert(0, typeof(EventName));
            EventCenter = new EventCenter(initializeData);
            yield return(null);


            EntityManager = new EntityManager(initializeData);
            yield return(null);

            DownloadManager = new TempDownloadManager();
            yield return(DownloadManager.InitializeAsync(initializeData));

            if (initializeData.UseAssetBundle)
            {
                AssetManager = new AssetManager();
                yield return(((AssetManager)AssetManager).InitializeAsync(initializeData));
            }

            //TempAssetInitManager
            AssetInitManager = new TempAssetInitManager();
            yield return(AssetInitManager.InitializeAsync(initializeData));

#if UNITY_EDITOR
            UiManager = new EditorFairyGUIWindowManager();
#else
            UiManager = new FairyGUIWindowManager();
#endif
            yield return(null);

            #region Initialize Packages
            List <Common.Utility.ReflectionUtility.MethodAndAttributeData> initializePackages = new List <Common.Utility.ReflectionUtility.MethodAndAttributeData>();
            Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
            for (int iAssembly = 0; iAssembly < assemblies.Length; iAssembly++)
            {
                Common.Utility.ReflectionUtility.CollectionMethodWithAttribute(initializePackages
                                                                               , assemblies[iAssembly]
                                                                               , BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public
                                                                               , typeof(InitializePackageAttribute)
                                                                               , false);
            }

            List <InitializePackageData> initializePackageDatas = new List <InitializePackageData>();
            for (int iPackage = 0; iPackage < initializePackages.Count; iPackage++)
            {
                initializePackageDatas.Add(new InitializePackageData(initializePackages[iPackage]));
            }
            initializePackageDatas.Sort(InitializePackageData.ComparerByPriority);
            yield return(null);

            object[] initializePackageParameters = new object[] { initializeData };
            for (int iPackage = 0; iPackage < initializePackageDatas.Count; iPackage++)
            {
                InitializePackageData iterPackageData = initializePackageDatas[iPackage];
                MDebug.Log("Core"
                           , $"Begin initialize package {iterPackageData.Name}");
                object result = iterPackageData.Method.Invoke(null, initializePackageParameters);
                if (result != null &&
                    result is IEnumerator enumerator)
                {
                    yield return(enumerator);
                }
                MDebug.Log("Core"
                           , $"End initialize package {iterPackageData.Name}");
                yield return(null);
            }
            #endregion
        }
예제 #17
0
 public virtual void UpdateBehaviour(BehaviourManager manager)
 {
 }
예제 #18
0
 public virtual bool checkBehaviour(BehaviourManager manager)
 {
     return(false);
 }
예제 #19
0
 public void Initialize(BehaviourManager _manager)
 {
     manager = _manager;
     mahHash = GetHashCode();
     string s = "shalom";
 }
예제 #20
0
        private void CreateChart()
        {
            chartPanel.Children.Remove(CurrentChart);
            CurrentChart = new Chart();
            chartPanel.Children.Add(CurrentChart);
            CurrentChart.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            CurrentChart.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            CurrentChart.LegendVisibility = System.Windows.Visibility.Collapsed;
            XAxesForamtString = Answer.Properties.XValueFormatString;
            XAxesType = Answer.Properties.XAxisType;

            chartPanel.Children.Remove(SettingsPanel);
            chartPanel.Children.Add(SettingsPanel);

            BehaviourManager manager=new BehaviourManager();
            manager.AllowMultipleEnabled = true;
            manager.IsEnabled = true;

            TrackballBehaviour track=new TrackballBehaviour();
            manager.Behaviours.Add(track);
            track.IsEnabled = true;
            track.TrackingMode = TrackingPointPattern.LineOnX;
            track.HideTrackballsOnMouseLeave = true;

            ZoomBehaviour zoom=new ZoomBehaviour();
            zoom.AnimationEnabled = false;
            zoom.ZoomMode = ZoomMode.MouseDrag;
            zoom.DisableAxisRendering = true;
            manager.Behaviours.Add(zoom);
            zoom.IsEnabled = true;

            TrackBehaviour = track;

            CurrentChart.LegendVisibility = Visibility.Collapsed;

            CurrentChart.Behaviour = manager;
        }
예제 #21
0
 private void Init()
 {
     behaviourManager = new BehaviourManager();
     inputManager     = new InputManager(behaviourManager);
 }
예제 #22
0
 public override void doBehaviour(BehaviourManager manager)
 {
     manager.agent.destination = target.transform.position;
 }
예제 #23
0
    public override bool checkBehaviour(BehaviourManager manager)
    {
        return(pathComplete(manager));

        return(false);
    }
예제 #24
0
		protected DynamicObject()
		{
			Behaviours = new BehaviourManager();
			_AnimatedProperties = new List<IPropertyAnimator>();
			BlendState = BlendState.AlphaBlend;
		}
예제 #25
0
 public virtual void doBehaviour(BehaviourManager manager)
 {
 }
예제 #26
0
        public UnitManager(LevelScreen screen)
        {
            this.screen = screen;
            behaviours  = new BehaviourManager();

            Settings unitSettings = null;

            {
                unitSettings = new Settings {
                    Health = 100, Damage = 30, AttackInterval = 0.1f, Speed = 4000
                };

                enemyClipNames[UnitType.Grunt] = "enemy";
                settings[UnitType.Grunt]       = unitSettings;
                unitLists[UnitType.Grunt]      = new List <Unit>(20);
            }

            {
                unitSettings = new Settings {
                    Health = 100, Damage = 30, AttackInterval = 0.1f, Speed = 4000
                };

                enemyClipNames[UnitType.Captain] = "enemy";
                settings[UnitType.Captain]       = unitSettings;
                unitLists[UnitType.Captain]      = new List <Unit>(20);
            }

            {
                unitSettings = new Settings {
                    Health = 100, Damage = 30, AttackInterval = 0.1f, Speed = 4000
                };

                enemyClipNames[UnitType.Boss] = "enemy";
                settings[UnitType.Boss]       = unitSettings;
                unitLists[UnitType.Boss]      = new List <Unit>(20);
            }

            {
                unitSettings = new Settings {
                    Health = 100, Damage = 40, AttackInterval = 0.1f, Speed = 4000
                };

                enemyClipNames[UnitType.Knight] = "knight";
                settings[UnitType.Knight]       = unitSettings;
                unitLists[UnitType.Knight]      = new List <Unit>(20);
            }

            for (int i = 0; i < NUM_LANES; ++i)
            {
                lanes[i] = LANE_START + (i * LANE_OFFSET);
            }
            laneCategories[0] = (Category)SpinelessCollisionCategories.Lane1;
            laneCategories[1] = (Category)SpinelessCollisionCategories.Lane2;
            laneCategories[2] = (Category)SpinelessCollisionCategories.Lane3;

            for (int i = 0; i < 10; ++i)
            {
                Create(UnitType.Grunt);
                Create(UnitType.Captain);
                Create(UnitType.Boss);
                Create(UnitType.Knight);
            }
        }
예제 #27
0
파일: Engine.cs 프로젝트: wow4all/Walker
 static Engine()
 {
   behaviourManager = new BehaviourManager();
   rendererManager = new RendererManager();
 }
예제 #28
0
        public MainWindowViewModel(IWindowManager windowManager, SimpleContainer container)
        {
            _windowManager = windowManager;
            _container = container;

            _sensorsToGraph = new ObservableCollection<GraphableSensor>();
            SensorsToCheckMethodsAgainst = new ObservableCollection<Sensor>();

            _erroneousValuesFromDataTable = new List<ErroneousValue>();

            #region Set Up Detection Methods
            ShowLastZoom = false;
            _minMaxDetector = new MinMaxDetector();
            _minMaxDetector.GraphUpdateNeeded += () =>
                                                     {
                                                         SampleValues(Common.MaximumGraphablePoints, _sensorsToGraph,
                                                                      "MinMaxDetectorGraphUpdate");
                                                         CalculateYAxis(false);
                                                     };

            _runningMeanStandardDeviationDetector = new RunningMeanStandardDeviationDetector();
            _runningMeanStandardDeviationDetector.GraphUpdateNeeded += () => SampleValues(Common.MaximumGraphablePoints, _sensorsToGraph, "RunningMeanGraphUpdate");

            _runningMeanStandardDeviationDetector.RefreshDetectedValues +=
                () => CheckTheseMethods(new Collection<IDetectionMethod> { _runningMeanStandardDeviationDetector });

            _missingValuesDetector = new MissingValuesDetector { IsEnabled = true };
            _selectedMethod = _missingValuesDetector;

            var repeatedValuesDetector = new RepeatedValuesDetector();

            repeatedValuesDetector.RefreshDetectedValues +=
                () => CheckTheseMethods(new Collection<IDetectionMethod> { repeatedValuesDetector });

            _detectionMethods = new List<IDetectionMethod> { _missingValuesDetector, repeatedValuesDetector, _minMaxDetector, new ToHighRateOfChangeDetector(), _runningMeanStandardDeviationDetector };

            #endregion

            #region Set Up Behaviours

            var behaviourManager = new BehaviourManager { AllowMultipleEnabled = true };

            #region Zoom Behaviour
            _zoomBehaviour = new CustomZoomBehaviour { IsEnabled = true };
            _zoomBehaviour.ZoomRequested += (o, e) =>
                                                {
                                                    ZoomState z = new ZoomState(StartTime, EndTime, Range);
                                                    _previousZoom.Add(z);
                                                    StartTime = e.LowerX;
                                                    EndTime = e.UpperX;
                                                    Range = new DoubleRange(e.LowerY, e.UpperY);
                                                    foreach (var detectionMethod in _detectionMethods.Where(x => x.IsEnabled))
                                                    {
                                                        var itemsToKeep =
                                                            detectionMethod.ListBox.Items.Cast<ErroneousValue>().Where(
                                                                x => x.TimeStamp >= StartTime && x.TimeStamp <= EndTime)
                                                                .ToList();
                                                        detectionMethod.ListBox.Items.Clear();
                                                        itemsToKeep.ForEach(x => detectionMethod.ListBox.Items.Add(x));
                                                    }
                                                    foreach (var sensor in _sensorsToGraph)
                                                    {
                                                        sensor.SetUpperAndLowerBounds(StartTime, EndTime);
                                                    }
                                                    SampleValues(Common.MaximumGraphablePoints, _sensorsToGraph, "Zoom");
                                                    ShowLastZoom = true;
                                                };
            _zoomBehaviour.ZoomResetRequested += o =>
                                                     {
                                                         _previousZoom.Clear();
                                                         foreach (var sensor in _sensorsToGraph)
                                                         {
                                                             sensor.RemoveBounds();
                                                         }
                                                         CalculateGraphedEndPoints();
                                                         SampleValues(Common.MaximumGraphablePoints, _sensorsToGraph, "ZoomReset");
                                                         CalculateYAxis();
                                                         CheckTheseMethods(_detectionMethods.Where(x => x.IsEnabled));
                                                         ShowLastZoom = false;
                                                         _previousZoom.Clear();
                                                     };
            _zoomBehaviour.LastZoomRequested += (o, e) =>
            {
                if (ShowLastZoom == true)
                {
                    ZoomState z = _previousZoom.GetLast();
                    StartTime = z.StartTime;
                    EndTime = z.EndTime;
                    Range = z.Range;
                    foreach (var detectionMethod in _detectionMethods.Where(x => x.IsEnabled))
                    {
                        var itemsToKeep =
                            detectionMethod.ListBox.Items.Cast<ErroneousValue>().Where(
                                x => x.TimeStamp >= StartTime && x.TimeStamp <= EndTime)
                                .ToList();
                        detectionMethod.ListBox.Items.Clear();
                        itemsToKeep.ForEach(x => detectionMethod.ListBox.Items.Add(x));
                    }
                    foreach (var sensor in _sensorsToGraph)
                    {
                        sensor.SetUpperAndLowerBounds(StartTime, EndTime);
                    }
                    SampleValues(Common.MaximumGraphablePoints, _sensorsToGraph, "Zoom");
                    if (_previousZoom.Count == 0)
                    {
                        ShowLastZoom = false;
                    }
                }

            };

            behaviourManager.Behaviours.Add(_zoomBehaviour);
            #endregion

            #region Background Behaviour
            _background = new Canvas { Visibility = Visibility.Collapsed };
            var backgroundBehaviour = new GraphBackgroundBehaviour(_background);
            behaviourManager.Behaviours.Add(backgroundBehaviour);
            #endregion

            #region Selection Behaviour

            _selectionBehaviour = new CustomSelectionBehaviour { IsEnabled = true };
            _selectionBehaviour.SelectionMade += (sender, args) =>
                                                     {
                                                         Selection = args;
                                                     };

            _selectionBehaviour.SelectionReset += sender =>
                                                      {
                                                          Selection = null;
                                                      };
            behaviourManager.Behaviours.Add(_selectionBehaviour);
            #endregion

            _dateAnnotator = new DateAnnotationBehaviour { IsEnabled = true };
            behaviourManager.Behaviours.Add(_dateAnnotator);

            _calibrationAnnotator = new CalibrationAnnotatorBehaviour(this) { IsEnabled = true };
            behaviourManager.Behaviours.Add(_calibrationAnnotator);

            behaviourManager.Behaviours.Add(new ChangesAnnotatorBehaviour(this) { IsEnabled = true });

            Behaviour = behaviourManager;

            #endregion

            PropertyChanged += (o, e) =>
                                   {
                                       if (e.PropertyName == "Selection")
                                           ActionsEnabled = Selection != null;
                                   };

            BuildDetectionMethodTabItems();

            var autoSaveTimer = new System.Timers.Timer();
            autoSaveTimer.Elapsed += (o, e) =>
                                         {
                                             if (CurrentDataset != null)
                                             {
                                                 Save();
                                             }
                                         };
            autoSaveTimer.AutoReset = true;
            autoSaveTimer.Interval = Properties.Settings.Default.AutoSaveTimerInterval;
            if (Properties.Settings.Default.AutoSaveTimerEnabled)
                autoSaveTimer.Start();

            Properties.Settings.Default.PropertyChanged += (o, e) =>
                                                               {
                                                                   switch (e.PropertyName)
                                                                   {
                                                                       case "AutoSaveTimerInterval":
                                                                           autoSaveTimer.Interval =
                                                                               Properties.Settings.Default.
                                                                                   AutoSaveTimerInterval;
                                                                           break;
                                                                       case "AutoSaveTimerEnabled":
                                                                           if (Properties.Settings.Default.AutoSaveTimerEnabled)
                                                                               autoSaveTimer.Start();
                                                                           else
                                                                               autoSaveTimer.Stop();
                                                                           break;
                                                                   }
                                                               };
        }
 public AutomaticMixer()
 {
     _behaviourManager = new BehaviourManager();
     _gatheringService = new GatheringService();
     _gatheringService.AudioSessionUpdate.Subscribe(args => OnMixerStateUpdate(_gatheringService, args));
 }
예제 #30
0
 private void OnDestroy()
 {
     BehaviourManager.UnregisterBehaviour(this); client_peer?.Shutdown();
 }
예제 #31
0
 private void Awake()
 {
     BehaviourManager.RegisterBehaviour(this);
     Query.Initialize();
     OnInit();
 }
예제 #32
0
        async void Start()
        {
            _log.Info("-------LOG STARTED----");

            MainUI.Instance.ShowLoginWindow("", "");

            //load behaviours

            if (Directory.Exists(Path.Combine(Application.dataPath, behavioursPath)))
            {
                BehaviourManager.LoadBehaviours(Path.Combine(Application.dataPath, behavioursPath));
            }
            else
            {
                _log.Info($"Path {Path.Combine(Application.dataPath, behavioursPath)} not exists, skipping assembly loading");
            }



            string sconfig = @"
         akka{
                  actor{
                 
              serializers
                           {
                            hyperion = ""Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion""
                           }
                         serialization-bindings {
                           ""System.Object"" = hyperion
                           }

    provider=""Akka.Remote.RemoteActorRefProvider,Akka.Remote""
                                                 
                        }
                
                 remote{
                    helios.tcp{
                            transport-class = ""Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote""
                        port =18098

                        hostname=localhost
                        }
                    }
                }
      ";

            var config = ConfigurationFactory.ParseString(sconfig);

            _clientId = Guid.NewGuid();

            try
            {
                AkkaSystem = ActorSystem.Create("JediumClient" + _clientId, config);
            }
            catch (Exception e)
            {
                Debug.Log(e);
                // throw;
            }

            DeadRequestProcessingActor.Install(AkkaSystem);
        }
예제 #33
0
        public bool Start()
        {
            _logger = LogManager.GetLogger("[MainHost]");

            _logger.Info("------------------------------JEDIUM SERVER---------------------------");
            _logger.Info("Starting at: " + DateTime.Now);

            //settings
            var     parser = new FileIniDataParser();
            IniData data   = parser.ReadFile("ServerConfig.ini");

            MainSettings.BehavioursPluginPath = data["Server"]["BehavioursPluginPath"];
            MainSettings.WebApiHost           = data["Server"]["WebApiHost"];
            MainSettings.DBUrl                   = data["Server"]["DBUrl"];
            MainSettings.DatabaseName            = data["Server"]["DatabaseName"];
            MainSettings.CollectMessageStats     = bool.Parse(data["Statistics"]["CollectMessageStats"]);
            MainSettings.StatsCollectionInterval = int.Parse(data["Statistics"]["StatsCollectionInterval"]);


            MD5 mcalc = MD5.Create();

            byte[] dbytes = File.ReadAllBytes("Domain.dll");
            MainSettings.ServerHash = mcalc.ComputeHash(dbytes).ToHex(false);
            _logger.Info($"Server domain hash: {MainSettings.ServerHash}");

            //load plugins
            BehaviourManager.LoadBehaviours(MainSettings.BehavioursPluginPath);



            //get config (app.config)
            AkkaConfigurationSection section = (AkkaConfigurationSection)ConfigurationManager.GetSection("akka");
            Config aconfig = section.AkkaConfig;


            //попытаться запустить актер сервера
            try
            {
                _system = ActorSystem.Create("VirtualFramework", aconfig);
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);
                throw;
            }

            // на случай разрыва соединения
            DeadRequestProcessingActor.Install(_system);


            _databaseAgent = _system.ActorOf(Props.Create(() => new MongoDbActor()), "DataBase")
                             .Cast <DatabaseAgentRef>(); //TODO: Add test for connection

            _terminal = _system.ActorOf(Props.Create(() => new TerminalConnection(_databaseAgent)), "Terminal")
                        .Cast <TerminalConnectionRef>();


            _serverConnection = _system
                                .ActorOf(Props.Create(() => new ServerConnection(_databaseAgent)), "ServerEndpoint")
                                .Cast <ConnectionRef>(); //TODO: find me

            //_databaseAgent.SetDummyObjectTest().Wait();


            _manager = _system
                       .ActorOf(Props.Create(() => new ObjectsManager(_databaseAgent, _serverConnection)), "ObjectManager")
                       .Cast <ObjectsManagerRef>();

            //assets host
            _webApiHost = _system
                          .ActorOf(Props.Create(() => new WebApiHost(MainSettings.WebApiHost, _databaseAgent, _manager)),
                                   "AssetsHost")
                          .Cast <WebApiHostRef>();


            _pluginsHost = _system.ActorOf(Props.Create(() => new PluginsHost(_databaseAgent, _manager)), "PluginsHost")
                           .Cast <PluginsHostRef>();

            _pluginsHost.LoadPlugins().Wait();


            _manager.LoadAllScenes().Wait();


            return(true);
        }