public void InitializeTestingEnvironnement()
        {
            dal = new FakeDal();

            beaconController               = new BeaconController(dal);
            beaconController.Request       = new HttpRequestMessage();
            beaconController.Configuration = new HttpConfiguration();
        }
Esempio n. 2
0
        public bool DeleteBeacon(int id)
        {
            var controller      = new BeaconController();
            var buddyController = new BuddyController();

            buddyController.DeleteBuddiesByBeacon(id);
            return(controller.DeleteBeacon(id));
        }
Esempio n. 3
0
    private Dictionary <string, List <Vector3> > LoadPaths(FileSystemInfo file)
    {
        var paths = new Dictionary <string, List <Vector3> >();

        using (var reader = new StreamReader(file.FullName))
        {
            string line;
            string pathName = null;
            while ((line = reader.ReadLine()) != null)
            {
                if (string.IsNullOrEmpty(line))
                {
                    pathName = null;
                    continue;
                }

                if (pathName == null)
                {
                    pathName = line;
                    paths.Add(pathName, new List <Vector3>());
                    continue;
                }

                var components = line.Split(' ');

                if (components.Length == 1)
                {
                    //Get the beacon by name, add it's location to the current path
                    var beacon = m_Beacons[components[0]];
                    paths[pathName].Add(beacon.transform.position);

                    if (!m_BeaconsOnPath.ContainsKey(pathName))
                    {
                        m_BeaconsOnPath[pathName]    = new BeaconController[2];
                        m_BeaconsOnPath[pathName][0] = beacon;
                    }
                    else
                    {
                        m_BeaconsOnPath[pathName][1] = beacon;
                    }

                    beacon.GetComponent <BeaconController>().AddPath(pathName);
                }
                else
                {
                    var x   = float.Parse(components[0]);
                    var y   = float.Parse(components[1]);
                    var z   = float.Parse(components[2]);
                    var pos = new Vector3(x, y, z);

                    paths[pathName].Add(pos);
                }
            }
        }

        return(paths);
    }
Esempio n. 4
0
 private void Awake()
 {
     Instance = this;
 }
Esempio n. 5
0
        public bool ChangeNumberOfDrinks(int id, int drinks)
        {
            var controller = new BeaconController();

            return(controller.PutBeacon(id, drinks));
        }
Esempio n. 6
0
        public bool PlaceBeacon(Beacon beacon, List <int> friends)
        {
            var controller = new BeaconController();

            return(controller.PostBeacon(beacon, friends));
        }
Esempio n. 7
0
        public Beacon GetBeacon(int id)
        {
            var controller = new BeaconController();

            return(controller.GetBeaconById(id));
        }
Esempio n. 8
0
        public IEnumerable <Beacon> GetBeaconsByCoords(double latitude, double longitude, int distance)
        {
            var controller = new BeaconController();

            return(controller.GetBeaconsByCoordinate(latitude, longitude, distance));
        }
Esempio n. 9
0
        public IEnumerable <Beacon> GetBeacons()
        {
            var controller = new BeaconController();

            return(controller.GetBeacons());
        }
        private void Initialize()
        {
            _buildable = GetComponent <Constructable>() ?? GetComponentInParent <Constructable>();

            if (FindComponents())
            {
                QuickLogger.Debug($"Turbine Components Found", true);

                _prefabID = GetComponentInParent <PrefabIdentifier>();

                var currentBiome = BiomeManager.GetBiome();

                if (!string.IsNullOrEmpty(currentBiome))
                {
                    var data = BiomeManager.GetBiomeData(currentBiome);
                }

                AISolutionsData.Instance.OnRotationChanged += AiSolutionsDataOnOnRotationChanged;

                if (HealthManager == null)
                {
                    HealthManager = gameObject.GetComponent <AIJetStreamT242HealthManager>() ?? GetComponentInParent <AIJetStreamT242HealthManager>();
                }


                HealthManager.Initialize(this);
                HealthManager.SetHealth(100);
                HealthManager.SetDamageModel(_damage);

                if (PowerManager == null)
                {
                    PowerManager          = GetComponentInParent <AIJetStreamT242PowerManager>() ?? GetComponent <AIJetStreamT242PowerManager>();
                    PowerManager.maxPower = 300;
                }



                if (PowerRelay == null)
                {
                    PowerRelay = gameObject.AddComponent <PowerRelay>();

                    PowerRelay.internalPowerSource = PowerManager;
                    PowerRelay.maxOutboundDistance = 15;
                    PowerRelay.dontConnectToRelays = false;


                    PowerFX    yourPowerFX = gameObject.AddComponent <PowerFX>();
                    PowerRelay powerRelay  = CraftData.GetPrefabForTechType(TechType.SolarPanel).GetComponent <PowerRelay>();

                    yourPowerFX.vfxPrefab   = powerRelay.powerFX.vfxPrefab;
                    yourPowerFX.attachPoint = gameObject.transform;
                    PowerRelay.powerFX      = yourPowerFX;

                    Resources.UnloadAsset(powerRelay);
                }

                PowerManager.Initialize(this);

                AnimationManager = gameObject.GetComponentInParent <AIJetStreamT242AnimationManager>();

                BeaconManager = gameObject.GetComponentInParent <BeaconController>();

                if (_display == null)
                {
                    _display = GetComponent <AIJetStreamT242Display>() ?? GetComponentInParent <AIJetStreamT242Display>();
                }

                IsInitialized = true;
                //_currentBiome = BiomeManager.GetBiome();
            }
            else
            {
                IsInitialized = false;
                throw new MissingComponentException("Failed to find all components");
            }

            if (!IsInitialized)
            {
                return;
            }

            PowerManager.OnKillBattery += Unsubscribe;
        }
Esempio n. 11
0
        private void Initialize()
        {
            _buildable = GetComponent <Constructable>() ?? GetComponentInParent <Constructable>();

            if (FindComponents())
            {
                QuickLogger.Debug($"Turbine Components Found", true);

                _prefabID = GetComponentInParent <PrefabIdentifier>();

                var currentBiome = BiomeManager.GetBiome();

                if (!string.IsNullOrEmpty(currentBiome))
                {
                    var data = BiomeManager.GetBiomeData(currentBiome);
                }

                AISolutionsData.Instance.OnRotationChanged += AiSolutionsDataOnOnRotationChanged;

                if (HealthManager == null)
                {
                    HealthManager = gameObject.GetComponent <AIJetStreamT242HealthManager>() ?? GetComponentInParent <AIJetStreamT242HealthManager>();
                }


                HealthManager.Initialize(this);
                HealthManager.SetHealth(100);
                HealthManager.SetDamageModel(_damage);

                if (PowerManager == null)
                {
                    PowerManager = GetComponentInParent <AIJetStreamT242PowerManager>() ?? GetComponent <AIJetStreamT242PowerManager>();
                }

                PowerManager.Initialize(this);

                AnimationManager = gameObject.GetComponentInParent <AIJetStreamT242AnimationManager>();

                BeaconManager = gameObject.GetComponentInParent <BeaconController>();

                if (_display == null)
                {
                    _display = GetComponent <AIJetStreamT242Display>() ?? GetComponentInParent <AIJetStreamT242Display>();
                }

                IsInitialized = true;
                //_currentBiome = BiomeManager.GetBiome();
            }
            else
            {
                IsInitialized = false;
                throw new MissingComponentException("Failed to find all components");
            }

            if (!IsInitialized)
            {
                return;
            }

            PowerManager.OnKillBattery += Unsubscribe;
        }
 private void Awake()
 {
     Animator                   = GetComponentInParent <Animator>();
     _beaconController          = GetComponentInParent <BeaconController>();
     _beaconController.Animator = Animator;
 }