Esempio n. 1
0
 public static void Postfix(Tornado __instance, IntVec3 c, ref bool __result)
 {
     // Shield-covered cells are immune to damage
     if (!__result)
     {
         var shieldGens = __instance.Map.GetComponent <ListerThingsExtended>().ListerShieldGensActive.ToList();
         for (int i = 0; i < shieldGens.Count; i++)
         {
             var gen = shieldGens[i];
             if (gen.coveredCells.Contains(c))
             {
                 if (!gen.affectedThings.ContainsKey(__instance))
                 {
                     gen.AbsorbDamage(30, DamageDefOf.TornadoScratch, __instance);
                     gen.affectedThings.Add(__instance, 15);
                 }
                 __result = true;
                 return;
             }
         }
     }
 }
    int attack()
    {
        //air.Play();
        int amount;

        //print("attacks");
        timer = 1f;
        int addedDmg = UnityEngine.Random.Range(-5, 6);

        amount = damage + addedDmg;
        return(amount);

        anim.SetTrigger("PunchTrigger");
        projectile = Instantiate(elementPrefab, new Vector3(this.transform.position.x, this.transform.position.y - 1f, this.transform.position.z), Quaternion.identity) as GameObject;
        Tornado elementShot = projectile.GetComponent <Tornado>();

        elementShot.setTarget(target);
        //elementShot.transform.position = target.transform.position;

        //projectile.GetComponent<Rigidbody>().AddForce(transform.forward * 10, ForceMode.Impulse);
        //Destroy(projectile);
    }
Esempio n. 3
0
    // Tornado
    IEnumerator Tornado(float travelTime, float bonusDamage, float liftDuration)
    {
        while (!Input.GetButtonUp("Fire1"))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            Physics.Raycast(ray, out hit);
            if (Input.GetButtonDown("Fire1"))
            {
                Vector3    relativePos = hit.point - transform.position;
                Quaternion rotation    = Quaternion.LookRotation(new Vector3(relativePos.x, 0, relativePos.z));
                print("Casted: Tornado");
                GameObject tornado  = Instantiate(tornadoPrefab, transform.position, rotation) as GameObject;
                Tornado    _tornado = tornado.GetComponent <Tornado>();
                _tornado.TravelTime   = travelTime;
                _tornado.BonusDamage  = bonusDamage;
                _tornado.LiftDuration = liftDuration;
                audioSource.PlayOneShot(spellSoundClips[3], 1);
            }
            yield return(null);
        }
    }
        /// <summary>
        /// Constructs a new demo.
        /// </summary>
        /// <param name="game">Game owning this demo.</param>
        public TornadoDemo(DemosGame game)
            : base(game)
        {
            shape   = new BoundingBoxForceFieldShape(new BoundingBox(new Vector3(-100, -20, -40), new Vector3(-20, 120, 40)));
            tornado = new Tornado(shape, (shape.BoundingBox.Min + shape.BoundingBox.Max) / 2, new Vector3(0, 1, 0),
                                  150, false, 50, 10, 200, 200, 80, 2000, 40, 10);
            tornado.ForceWakeUp = true; //The tornado will be moving, so it should wake up things that it comes into contact with.
            Space.Add(tornado);

            //Create the unfortunate box-like citizens about to be hit by the tornado.
            int    numColumns = 10;
            int    numRows    = 10;
            int    numHigh    = 1;
            float  separation = 1.5f;
            Entity toAdd;

            for (int i = 0; i < numRows; i++)
            {
                for (int j = 0; j < numColumns; j++)
                {
                    for (int k = 0; k < numHigh; k++)
                    {
                        toAdd = new Box(new Vector3(
                                            separation * i - numRows * separation / 2,
                                            5 + k * separation,
                                            separation * j - numColumns * separation / 2),
                                        1, 1, 1, 10);
                        Space.Add(toAdd);
                    }
                }
            }

            //x and y, in terms of heightmaps, refer to their local x and y coordinates.  In world space, they correspond to x and z.
            //Setup the heights of the terrain.
            //[The size here is limited by the Reach profile the demos use- the drawer draws the terrain as a big block and runs into primitive drawing limits.
            //The physics can support far larger terrains!]
            int xLength = 180;
            int zLength = 180;

            float xSpacing = 8f;
            float zSpacing = 8f;
            var   heights  = new float[xLength, zLength];

            for (int i = 0; i < xLength; i++)
            {
                for (int j = 0; j < zLength; j++)
                {
                    float x = i - xLength / 2;
                    float z = j - zLength / 2;
                    //heights[i,j] = (float)Math.Pow(1.2 * Math.Sqrt(x * x + y * y), 2);
                    //heights[i,j] = -1f / (x * x + y * y);
                    //heights[i,j] = (float)(x * y / 100f);
                    heights[i, j] = (float)(5 * (Math.Sin(x / 8f) + Math.Sin(z / 8f)));
                    //heights[i,j] = 3 * (float)Math.Sin(x * y / 100f);
                    //heights[i,j] = (x * x * x * y - y * y * y * x) / 1000f;
                }
            }

            //Create the terrain.
            var terrain = new Terrain(heights, new AffineTransform(
                                          new Vector3(xSpacing, 1, zSpacing),
                                          Quaternion.Identity,
                                          new Vector3(-xLength * xSpacing / 2, 0, -zLength * zSpacing / 2)));

            Space.Add(terrain);
            game.ModelDrawer.Add(terrain);
            game.Camera.Position = new Vector3(0, 5, 60);
        }
Esempio n. 5
0
    void Start()
    {
        Time.timeScale = timescale;
        controller = gameObject.GetComponent<BaseController>();
        animator = GetComponentInChildren<Animator>();

        comboAction = GetComponent<Combo>();
        dashAction = GetComponent<Dash>();
        blockAction = GetComponent<Block>();
        airFloatAction = GetComponent<AirFloat>();
        slamAction = GetComponent<Slam>();
        tornadoAction = GetComponent<Tornado>();

        if (GetComponent<AirAttack>() != null)
        {
            airSpecialAction = GetComponent<AirAttack>();
        }
        else if (GetComponent<AirSpecial>())
        {
            airSpecialAction = GetComponent<AirSpecial>();
        }

        controller.OnLand += HandleLanding;

        PlayerInput.SwipeLeft += SwipeLeft;
        PlayerInput.SwipeRight += SwipeRight;
    }
Esempio n. 6
0
    private void Start()
    {
        actor = this.gameObject.GetComponent <Tornado>();

        //add nullchecks!
    }
Esempio n. 7
0
        /// <summary>
        /// Initialize/Finalize Tornado table
        /// </summary>
        /// <param name="Indexes"></param>
        /// <param name="indexUpdate"></param>
        public static void UpdateInsertTornadoData( int quantile, int indexUpdate)
        {
            try
            {
                var sensivities = K_DataManager.K_DataModel.SensitivityBudgetItemScenarioValues.Where(b =>
                   K_DataManager.K_DataModel.BudgetItems.Where(i => K_DataManager.CompanyIDsList.Contains((int)i.CompanyID)).Select(i => i.BudgetItemID).Contains((int)b.BudgetItemID)).ToList();
                foreach (var b in sensivities)
                {
                    var tornado = K_DataManager.K_DataModel.Tornadoes.Find(b.BudgetItemID, indexUpdate, b.Date);
                    if (tornado == null) // First quantile update, create new record
                    {
                        tornado = new Tornado()
                               {
                                   BudgetItemID = b.BudgetItemID,
                                   SeriesID = indexUpdate,
                                   Date = b.Date
                               };
                        K_DataManager.K_DataModel.Tornadoes.Add(tornado);
                    }
                    switch (quantile)
                    {
                        case 1:
                            tornado.Fq1 = b.Value; break;
                        case 5:
                            tornado.Fq5 = b.Value; break;
                        case 50:
                            tornado.Fq50 = b.Value; break;
                        case 95:
                            tornado.Fq95 = b.Value; break;
                        case 99:
                            tornado.Fq99 = b.Value; break;
                        default:
                            break;
                    }
                }

                K_DataManager.K_DataModel.SaveChanges();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
 private void btn_add_Click(object sender, RoutedEventArgs e)
 {
     if (SprawdzCzyDatySaWpisane())
     {
         if (SprawdzDaty())
         {
             if (SprawdzCzas())
             {
                 if (comboBox_Zjawiska.SelectedIndex == 0)
                 {
                     if (SprawdzPola_123())
                     {
                         typ = SprawdzTyp();
                         Opad_deszczu od = new Opad_deszczu(UstawCzasObs(), UstawCzasZak(), skala, Math.Round(slider_iloscOpadow.Value, 0), Math.Round(slider_srednicaKropel.Value, 3), typ, (decimal)Math.Round(slider_temp.Value, 2), Math.Round(slider_cisnienie.Value, 0), Math.Round(slider_predkoscWiatru.Value, 2));
                         sp.Dodaj(od);
                         c_Slask_xml.ZapiszXML("test.xml");
                         End();
                     }
                     else
                     {
                         WyswietlBladPola();
                         lab_Error.Content = "Nie podano jakiejś wartości!!";
                     }
                 }
                 else if (comboBox_Zjawiska.SelectedIndex == 1)
                 {
                     if (SprawdzPola_123())
                     {
                         typ = SprawdzTyp();
                         Opad_sniegu os = new Opad_sniegu(UstawCzasObs(), UstawCzasZak(), skala, Math.Round(slider_iloscOpadow.Value, 0), Math.Round(slider_srednicaKropel.Value, 3), typ, (decimal)Math.Round(slider_temp.Value, 2), Math.Round(slider_cisnienie.Value, 0), Math.Round(slider_predkoscWiatru.Value, 2));
                         sp.Dodaj(os);
                         c_Slask_xml.ZapiszXML("test.xml");
                         End();
                     }
                     else
                     {
                         WyswietlBladPola();
                         lab_Error.Content = "Nie podano jakiejś wartości!!";
                     }
                 }
                 else if (comboBox_Zjawiska.SelectedIndex == 2)
                 {
                     if (SprawdzPola_123())
                     {
                         typ = SprawdzTyp();
                         Opad_gradu og = new Opad_gradu(UstawCzasObs(), UstawCzasZak(), skala, Math.Round(slider_iloscOpadow.Value, 0), Math.Round(slider_srednicaKropel.Value, 3), typ, (decimal)Math.Round(slider_temp.Value, 2), Math.Round(slider_cisnienie.Value, 0), Math.Round(slider_predkoscWiatru.Value, 2));
                         sp.Dodaj(og);
                         c_Slask_xml.ZapiszXML("test.xml");
                         End();
                     }
                     else
                     {
                         WyswietlBladPola();
                         lab_Error.Content = "Nie podano jakiejś wartości!!";
                     }
                 }
                 else if (comboBox_Zjawiska.SelectedIndex == 3)
                 {
                     if (SprawdzPola_4())
                     {
                         if (SprawdzWyladowania())
                         {
                             typ = SprawdzTyp();
                             int   wyladowania = Int32.Parse(textBox_iloscWyladowan.Text);
                             Burza b           = new Burza(UstawCzasObs(), UstawCzasZak(), skala, wyladowania, Math.Round(slider_iloscOpadow.Value, 0), Math.Round(slider_srednicaKropel.Value, 3), typ, (decimal)Math.Round(slider_temp.Value, 2), Math.Round(slider_cisnienie.Value, 0), Math.Round(slider_predkoscWiatru.Value, 2));
                             sp.Dodaj(b);
                             c_Slask_xml.ZapiszXML("test.xml");
                             End();
                         }
                         else
                         {
                             WyswietlBladPola();
                             lab_Error.Content = "Podano błędną ilość wyładowań!!";
                         }
                     }
                     else
                     {
                         WyswietlBladPola();
                         lab_Error.Content = "Nie podano jakiejś wartości!!";
                     }
                 }
                 else if (comboBox_Zjawiska.SelectedIndex == 4)
                 {
                     if (SprawdzPola_5())
                     {
                         typ = SprawdzTyp();
                         Tornado tornado = new Tornado(UstawCzasObs(), UstawCzasZak(), skala, (decimal)Math.Round(slider_temp.Value, 2), Math.Round(slider_cisnienie.Value, 0), Math.Round(slider_predkoscWiatru.Value, 2), SprawdzSkale());
                         sp.Dodaj(tornado);
                         c_Slask_xml.ZapiszXML("test.xml");
                         End();
                     }
                     else
                     {
                         WyswietlBladPola();
                         lab_Error.Content = "Nie podano jakiejś wartości!!";
                     }
                 }
             }
             else
             {
                 WyswietlBladPola();
                 lab_Error.Content     = "Podano złą godzinę!!";
                 lab_format.Visibility = Visibility.Visible;
             }
         }
         else
         {
             WyswietlBladPola();
             lab_Error.Content = "Podano błędne daty!!";
         }
     }
     else
     {
         WyswietlBladPola();
         lab_Error.Content = "Nie podano daty!!";
     }
 }
Esempio n. 9
0
 static void Prefix(Tornado __instance)
 {
     GraphicsDrawMeshPatch.data = (__instance.Map.CarouselComp().current, new Vector3(__instance.realPosition.x, 0, __instance.realPosition.y));
 }
 public State1_Wander_Tornado(Tornado actor, NavMeshAgent navMeshAgent)
 {
     this.actor        = actor;
     this.navMeshAgent = navMeshAgent;
 }
Esempio n. 11
0
 public static void OnTornadoDeath(GameObject tornado)
 {
     tornadoRunning       = false;
     TornadoEvent.tornado = null;
 }
Esempio n. 12
0
 public State1_Awake_Tornado(Tornado actor)
 {
     this.actor = actor;
 }