Exemplo n.º 1
0
 public static WindGenerator CreateWindGenerator(float strength, float regularity)
 {
     WindGenerator wind = new WindGenerator();
     wind.Strength = strength;
     wind.Regularity = regularity;
     return wind;
 }
Exemplo n.º 2
0
 void Awake()
 {
     windGenerator  = FindObjectOfType <WindGenerator>();
     solarZellen    = FindObjectOfType <SolarZellen>();
     kohleGenerator = FindObjectOfType <KohleGenerator>();
     ressourcen     = FindObjectOfType <Ressourcen>();
 }
Exemplo n.º 3
0
        public void WindGeneratorConstructor_BadParameters1(int windMillCnt, int aggregateONCnt, double power)
        {
            windMillMock.Object.Coefficient     = 0.30;
            windMillMock.Object.TurbineDiameter = 30;
            WindGenerator windGenerator = new WindGenerator(weatherMock.Object, windMillMock.Object, windMillCnt, aggregateMock.Object, aggregateONCnt, power);

            Assert.AreEqual(windGenerator.WindMillCnt, windMillCnt);
        }
Exemplo n.º 4
0
        public void WindGeneratorConstructor_GoodParameters(int windMillCnt, int aggregateONCnt, double power)
        {
            // setovanje vrednosti neophodnih polja, konstruktori ovih klasa su svakako vec testirani
            windMillMock.Object.Coefficient     = 0.30;
            windMillMock.Object.TurbineDiameter = 30;
            WindGenerator windGenerator = new WindGenerator(weatherMock.Object, windMillMock.Object, windMillCnt, aggregateMock.Object, aggregateONCnt, power);

            Assert.AreEqual(windGenerator.WindMillCnt, windMillCnt);
            Assert.AreEqual(windGenerator.AggregateONCnt, aggregateONCnt);
            Assert.AreEqual(windGenerator.Power, power);
        }
Exemplo n.º 5
0
    void Start()
    {
//		if (!networkView.isMine) {
//			enabled = false;
//		} else {
        wind_generator = GetComponent <WindGenerator>();
//			audio_controller = GetComponent<AudioController>();
//			audio_controller.wind_position_offset = 10;
        balance_bar_length      = player_health * balance_bar_scale_x;
        balance_bar_length_init = balance_bar_length;
        //}
    }
Exemplo n.º 6
0
    public void MakeJump(int kPoint, WindGenerator wind)
    {
        float randomizationRange = kPoint * 0.05f;                     //+- of the distance
        float distanceFactor     = 0;                                  //Dependes of the JumpSkill property
        float windImpact         = wind.windFactor() * kPoint * 0.06f; //The Wind impact

        switch (JumpSkill)
        {
        case Skill.veryWeak:
            distanceFactor += 0.975f;
            break;

        case Skill.weak:
            distanceFactor += 0.995f;
            break;

        case Skill.average:
            distanceFactor += 1.015f;
            break;

        case Skill.good:
            distanceFactor += 1.035f;
            break;

        case Skill.veryGood:
            distanceFactor += 1.065f;
            break;

        default:
            Debug.Log("Jump Skill of the " + Name + " is out of range!");
            break;
        }
        float distance = kPoint * distanceFactor + windImpact;

        int randomization = (int)Random.Range(0, 50);

        if (randomization == 13)
        {
            distance = (Random.Range(distance - 3 * randomizationRange, distance + randomizationRange));
        }
        else if (randomization == 12)
        {
            distance = (Random.Range(distance - randomizationRange, distance + 2 * randomizationRange));
        }
        else
        {
            distance = (Random.Range(distance - randomizationRange, distance + randomizationRange));
        }

        distance = Mathf.Round(distance * 2) / 2;
        AddScores(distance, CalculatePoints(distance));
    }
        public CompareGeneratorsStats()
        {
            InitializeComponent();
            main = (MainWindow)Application.Current.MainWindow;
            Compare();
            cb1.ItemsSource   = main.vm.WindGenerators.Select(x => x.Name + " (" + x.RatedPower + "W)");
            cb1.SelectedIndex = 0;
            gen1 = main.vm.WindGenerators.Where(x => x.Id == main.vm.WindGenerators.ToList()[cb1.SelectedIndex].Id).FirstOrDefault();

            cb2.ItemsSource   = main.vm.WindGenerators.Select(x => x.Name + " (" + x.RatedPower + "W)");
            cb2.SelectedIndex = 0;
            gen2 = main.vm.WindGenerators.Where(x => x.Id == main.vm.WindGenerators.ToList()[cb2.SelectedIndex].Id).FirstOrDefault();
        }
Exemplo n.º 8
0
        public Generator GetWindTotalGenerationValue(WindGenerator windGenerator,
                                                     decimal valueFactor)
        {
            Generator dailyGenerator = new Generator();

            dailyGenerator.Name = windGenerator.Name;
            foreach (var day in windGenerator.Generation.Day)
            {
                dailyGenerator.Total = dailyGenerator.Total
                                       + day.Price * day.Energy * valueFactor;
            }
            return(dailyGenerator);
        }
Exemplo n.º 9
0
 void Awake()
 {
     goldMiner      = FindObjectOfType <GoldMiner>();
     goldSeller     = FindObjectOfType <GoldSeller>();
     miner          = FindObjectOfType <Miner>();
     steinSeller    = FindObjectOfType <SteinSeller>();
     doubleSeller   = FindObjectOfType <DoubleSeller>();
     seller         = FindObjectOfType <Seller>();
     solarZellen    = FindObjectOfType <SolarZellen>();
     windGenerator  = FindObjectOfType <WindGenerator>();
     kohleGenerator = FindObjectOfType <KohleGenerator>();
     // money = GameObject.Find("Canvas/Money").GetComponent<Text>();
     //Energie = GameObject.Find("Canvas/Energy").GetComponent<Text>();
 }
Exemplo n.º 10
0
 void Awake()
 {
     goldSeller     = FindObjectOfType <GoldSeller>();
     steinSeller    = FindObjectOfType <SteinSeller>();
     doubleSeller   = FindObjectOfType <DoubleSeller>();
     kohleGenerator = FindObjectOfType <KohleGenerator>();
     windGenerator  = FindObjectOfType <WindGenerator>();
     diamondMiner   = FindObjectOfType <DiamondMiner>();
     eisenMiner     = FindObjectOfType <EisenMiner>();
     goldMiner      = FindObjectOfType <GoldMiner>();
     miner          = FindObjectOfType <Miner>();
     solarZellen    = FindObjectOfType <SolarZellen>();
     mapManager     = FindObjectOfType <MapManager>();
     map            = FindObjectOfType <Tilemap>();
     dataFromTiles  = new Dictionary <TileBase, TileData>();
 }
Exemplo n.º 11
0
        private void Initialize()
        {
            Generators.IGenerator windGenerator = new WindGenerator();
            Generators.IGenerator coalGenerator = new CoalGenerator();
            Generators.IGenerator gasGenerator  = new GasGenerator();

            string val  = ConfigurationManager.AppSettings["ReferenceDataPath"];
            string path = System.Environment.ExpandEnvironmentVariables(val);

            XDocument xdocument = XDocument.Load(path);
            IEnumerable <XElement> referenceDatas = xdocument.Elements();

            foreach (var referenceData in referenceDatas)
            {
                Console.WriteLine(referenceData);
            }
        }
Exemplo n.º 12
0
    Vector2 InitVelocity(Vector2 val, int i, int j)
    {
        if (m_obstacle[ij2index(i, j)] != OBSTACLE_EMPTY)
        {
            return(Vector2.zero);
        }
        // set up test ray and mask
        Vector3 pos = ij2Pos(i, j);

        pos.z += -5.0f;
        Ray ray = new Ray();

        ray.direction = Vector3.forward;
        ray.origin    = pos;
        float distance = 20f;
        int   mask     = LayerMask.GetMask("WindGenerator");

        RaycastHit[] hitInfo = Physics.RaycastAll(ray, distance, mask);           // if there is land in forward
        if (hitInfo != null)
        {
            foreach (RaycastHit hit in hitInfo)
            {
                WindGenerator generator = hit.collider.gameObject.GetComponent <WindGenerator>();
                if (generator != null)
                {
                    return(generator.GetVelocity(ij2Pos(i, j)));
                }
            }
        }


        RaycastHit2D[] hitInfo2d = Physics2D.GetRayIntersectionAll(ray, distance, mask);
        if (hitInfo2d != null)
        {
            foreach (RaycastHit2D hit in hitInfo2d)
            {
                WindGenerator generator = hit.collider.gameObject.GetComponent <WindGenerator>();
                if (generator != null)
                {
                    return(generator.GetVelocity(ij2Pos(i, j)));
                }
            }
        }

        return(Vector2.zero);
    }
Exemplo n.º 13
0
 void Awake()
 {
     map            = FindObjectOfType <Tilemap>();
     goldSeller     = FindObjectOfType <GoldSeller>();
     steinSeller    = FindObjectOfType <SteinSeller>();
     ressourcen     = FindObjectOfType <Ressourcen>();
     doubleSeller   = FindObjectOfType <DoubleSeller>();
     kohleGenerator = FindObjectOfType <KohleGenerator>();
     windGenerator  = FindObjectOfType <WindGenerator>();
     diamondMiner   = FindObjectOfType <DiamondMiner>();
     einsenMiner    = FindObjectOfType <EisenMiner>();
     seller         = FindObjectOfType <Seller>();
     miner          = FindObjectOfType <Miner>();
     solarZellen    = FindObjectOfType <SolarZellen>();
     mapManager     = FindObjectOfType <MapManager>();
     dataFromTiles  = new Dictionary <TileBase, TileData>();
     StartCoroutine(SteinCounter());
 }
Exemplo n.º 14
0
        private void CreateModels()
        {
            ResourceDictionary dictionary;

            // All wind generator models are stored in ModelsDictionary.xaml ResourceDictionary
            dictionary        = new ResourceDictionary();
            dictionary.Source = new Uri("/Resources/ModelsDictionary.xaml", UriKind.RelativeOrAbsolute);

            _landscapeModel = dictionary["LandscapeModel"] as GeometryModel3D;

            GroundModelGroup.Children.Add(_landscapeModel);

            // Create one Wind Generator
            _windGenarator          = new WindGenerator();
            _windGenarator.Height   = 100;
            _windGenarator.Position = new Point3D(19.4, 182.8, 141.4);

            GeneratorsGroup.Children.Add(_windGenarator.Model);

            // Out ThirdPersonCamera will look at the Wind Generator
            Camera1.CenterObject = _windGenarator.Model;
        }
Exemplo n.º 15
0
 void Start()
 {
     _rb = GetComponent <Rigidbody2D>();
     _rb.gravityScale   = 0;
     _wind              = Wind.GetComponent <WindGenerator>();
     _bestAirResistance = Quaternion.Euler(new Vector3(0, 0, -21));
     _highScoreLine     = HighScore.GetComponent <HighScoreLine>();
     _lastPrefab        = 0;
     State              = playerState.Wait;
     if (_competitionManager == null)
     {
         _competitionManager = FindObjectOfType <CompetitionManager>();
         if (_competitionManager == null)
         {
             Debug.LogError("There is no _competition manager instatieted!");
         }
         _competition = _competitionManager as HotSeatCompetition;
         if (_competition != null)
         {
             _competition.ShowName();
         }
     }
 }
Exemplo n.º 16
0
    public virtual void Result()
    {
        if (GameManager == null)
        {
            Init();
        }

        switch (Competition)
        {
        case CompetitionStatus.round:
            Wind = FindObjectOfType <WindGenerator>();
            if (Wind == null)
            {
                Debug.LogError("Competition Manager cannot acces Wind Generator component!");
            }
            foreach (Jumper jumper in CompetitionJumpers)
            {
                Enemy enemy = jumper as Enemy;
                if (enemy != null)
                {
                    enemy.MakeJump(GameManager.CurrentHill.KPoint, Wind);
                }
            }
            ShowScoreTable();
            Competition = CompetitionStatus.scoreTable;
            break;

        case CompetitionStatus.scoreTable:
            RoundsLeft--;
            Competition = CompetitionStatus.round;
            EndRound();
            break;

        default:
            break;
        }
    }
Exemplo n.º 17
0
 void Awake()
 {
     mapGenerator   = FindObjectOfType <mapGenerator>();
     windGenerator  = FindObjectOfType <WindGenerator>();
     mapManager     = FindObjectOfType <MapManager>();
     clintConnects  = FindObjectOfType <Clintconnects>();
     solarZellen    = FindObjectOfType <SolarZellen>();
     kohleGenerator = FindObjectOfType <KohleGenerator>();
     steinSeller    = FindObjectOfType <SteinSeller>();
     seller         = FindObjectOfType <Seller>();
     miner          = FindObjectOfType <Miner>();
     goldSeller     = FindObjectOfType <GoldSeller>();
     goldMiner      = FindObjectOfType <GoldMiner>();
     eisenMiner     = FindObjectOfType <EisenMiner>();
     doubleSeller   = FindObjectOfType <DoubleSeller>();
     diamondMiner   = FindObjectOfType <DiamondMiner>();
     map            = FindObjectOfType <Tilemap>();
     Alive          = true;
     if (isLocalPlayer)
     {
         test();
     }
     StartCoroutine(Waitforplayer());
 }
 private void Cb2_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     gen2 = main.vm.WindGenerators.Where(x => x.Id == main.vm.WindGenerators.ToList()[cb2.SelectedIndex].Id).FirstOrDefault();
     Compare();
 }
 void Start()
 {
     //		if (!networkView.isMine) {
     //			enabled = false;
     //		} else {
         wind_generator = GetComponent<WindGenerator>();
     //			audio_controller = GetComponent<AudioController>();
     //			audio_controller.wind_position_offset = 10;
         balance_bar_length = player_health * balance_bar_scale_x;
         balance_bar_length_init = balance_bar_length;
     //}
 }
Exemplo n.º 20
0
 public void WindGeneratorConstructor_BadParameters2(Weather weather, WindMill windMill, int windMillCnt, Aggregate aggregate, int aggregateONCnt, double power)
 {
     WindGenerator windGenerator = new WindGenerator(weather, windMill, windMillCnt, aggregate, aggregateONCnt, power);
 }
Exemplo n.º 21
0
 void Start()
 {
     WindGenerator = FindObjectOfType <WindGenerator>();
     Rigidbody     = GetComponent <Rigidbody>();
 }