public void superReset()
 {
     Vector3 position = new Vector3 (5.405118f, 5.086665f, -0.2f);
     transform.position = position;
     currentPower = power.none;
     haltPowers ();
 }
 public void reset()
 {
     Vector3 position = new Vector3 (5.405118f + (transform.position.x - transform.position.x % 200f), 5.086665f, -0.2f);
     transform.position = position;
     currentPower = power.none;
     haltPowers ();
 }
Exemple #3
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag == "Enemy")
     {
         col.gameObject.SendMessage("Die");
         if (col.gameObject.layer == 13)
             SendMessageUpwards("addPoints", 900);
         else
             SendMessageUpwards ("addPoints", 200);
     } else if (col.gameObject.tag == "BeamEnemy") {
         powerGained = power.beam;
         SendMessageUpwards("assignPower", (int)powerGained);
         SendMessageUpwards ("addPoints", 300);
         col.gameObject.SendMessage("Die");
     } else if (col.gameObject.tag == "ElectricEnemy") {
         powerGained = power.electric;
         SendMessageUpwards("assignPower", (int)powerGained);
         SendMessageUpwards ("addPoints", 300);
         col.gameObject.SendMessage("Die");
     } else if (col.gameObject.tag == "FireEnemy") {
         powerGained = power.fire;
         SendMessageUpwards("assignPower", (int)powerGained);
         SendMessageUpwards ("addPoints", 300);
         col.gameObject.SendMessage("Die");
     }
 }
 public UserInfo()
 {
     _id = "";
     _password = "";
     _power = new power();
     _state = "";
     _lastlogin = "";
     _count = 0;
 }
 public UserInfo(string id, string password, power p, string state, string lastlogin, int count)
 {
     _id = id;
     _password = password;
     _power = p;
     _state = state;
     _lastlogin = lastlogin;
     _count = count;
 }
 public void getHit()
 {
     if (Time.time - initialTime >= 2) {
         initialTime = Time.time;
         currentPower = power.none;
         powerInterrupt = true;
         haltPowers ();
         hud.loseHealth();
     }
 }
Exemple #7
0
    public PowerData(PowerUI powerUI)
    {
        P.Clear();
        for (int i = 0; i < powerUI.power.Length; i++)
        {
            power test = new power();
            test.id     = powerUI.power[i].id;
            test.number = powerUI.power[i].amount;

            P.Add(test);
        }
    }
Exemple #8
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        GameObject item = other.gameObject;

        if (item.tag == "fireCrystal")
        {
            status = power.Fire;
            Debug.Log(status);
            Destroy(item);
        }

        if (item.tag == "iceCrystal")
        {
            status = power.Ice;
            Debug.Log(status);
            Destroy(item);
        }

        if (item.tag == "sizeCrystal")
        {
            size_up();
            Destroy(item);
        }

        if (item.tag == "heart")
        {
            int tempHealth = healthPickUp + curr_health;
            if (tempHealth > max_health)
            {
                curr_health = max_health;
            }
            else
            {
                curr_health = tempHealth;
            }
            float tempcur = curr_health;
            float tempmax = max_health;
            HpBar.value = tempcur / tempmax;
            Destroy(item);
        }

        // Repeat if statement for different type of crystals/droplets
    }
Exemple #9
0
    private void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "power")
        {
            power pow = col.gameObject.GetComponent <power>();

            if (pow.num == 0)
            {
                GetComponent <Rigidbody>().velocity *= 2f;
            }
            else
            {
                float x = transform.position.x;
                float z = transform.position.z;

                launch(x, z);
                Instantiate(ball, new Vector3(x, 0, z), Quaternion.identity);
            }
        }
    }
Exemple #10
0
 public base_personnage(string _name,int _ID,santé _Santé, mana _Mana, energie _Energie, poudre _Poudre, vitess _Vitess, armor _Armor, encaissement _Encaissement, speed _Speed, tenacity _Tenacity, range _Range, damage _Damage, power _Power, life_steal _Life_Steal, vampirisme _Vampirisme, List<tool> _LT)
 {
     name = _name;
     ID = _ID;
     Santé = _Santé;
     Mana = _Mana;
     Energie = _Energie;
     Poudre = _Poudre;
     Vitess = _Vitess;
     Armor = _Armor;
     encaissement = _Encaissement;
     Speed = _Speed;
     Tenacity = _Tenacity;
     Range = _Range;
     Damage = _Damage;
     Power = _Power;
     Life_Steal = _Life_Steal;
     Vampirisme = _Vampirisme;
     List_tool = new List<tool>();
     List_tool = _LT;
 }
 public void assignPower(power acquiredPower)
 {
     haltPowers ();
     powerInterrupt = true;
     currentPower = acquiredPower;
 }
        /// <summary>
        /// Запрос дополнительных параметров мощности, тока, коэффициента мощности
        /// </summary>
        /// <param name="param">тип перечисления BWIR_param</param>
        /// <param name="Num_Of_Phase">Номер фазы 1, 2, 3. Для Мощности и коэффициента мощности 0 - по сумме фаз</param>
        /// <param name="query">Номер функции для запроса. 14, 16 , 11 . По умолчанию 16
        ///                     14 - чтение зафиксрованных данных</param>
        /// <param name="powerType">The param Для чтения мощности - P, Q или S</param>
        /// <returns>Возвращает параметры Сумма, Фаза1, Фаза2, Фаза3. Или Значение для одной фазы</returns>
        ///
        ///
        public int[] CallAdditionalParameters(BWIR_param param, byte Num_Of_Phase, AdditionalParameters_query query = AdditionalParameters_query.h16, power powerType = power.P)
        {
            byte[] mes = new byte[4];
            mes[0] = address;
            mes[1] = 0x08;
            mes[2] = (byte)query;
            if (param == BWIR_param.frequency)
            {
                Num_Of_Phase = 0;
            }
            mes[3] += (byte)(((byte)param << 4) + ((byte)powerType << 2) + Num_Of_Phase);
            RXmes Rxmes_ = SendCmd(mes);

            if (Rxmes_.buff != null)
            {
                if (((Rxmes_.buff.Length - 3) % 4) > 0)
                {
                    int[] j = new int[(Rxmes_.buff.Length - 3) / 3];
                    for (int i = 0; i < j.Length; i++)
                    {
                        byte[] newbyte = { Rxmes_.buff[3 * i + 1], Rxmes_.buff[3 * i + 2], Rxmes_.buff[3 * i + 3] };

                        j[i] = (newbyte[0] << 16) + (newbyte[2] << 8) + newbyte[1];
                    }
                    return(j);
                }
                else if ((Rxmes_.buff.Length - 3) == 12) // ответ включает Сумма + 1ф + 2ф + 3ф  = 12байт
                {
                    int[] j = new int[4];
                    for (int i = 0; i < j.Length; i++)
                    {
                        byte[] newbyte = { Rxmes_.buff[3 * i + 1], Rxmes_.buff[3 * i + 2], Rxmes_.buff[3 * i + 3] };

                        // 6 бит 1 байта данных - направление реактивной мощности этот бит обнуляем
                        // 7 бит - направление активной мощности .
                        j[i] = ((newbyte[0] & 128) == 1 ? -1 : 1) * ((newbyte[0] & 0x3F) << 16) + (newbyte[2] << 8) + newbyte[1];
                    }
                    return(j);
                }
                else
                {
                    int[] j = new int[(Rxmes_.buff.Length - 3) / 4];
                    for (int i = 0; i < j.Length; i++)
                    {
                        byte[] newbyte = { Rxmes_.buff[4 * i + 1], Rxmes_.buff[4 * i + 2], Rxmes_.buff[4 * i + 3], Rxmes_.buff[4 * i + 4] };

                        j[i] = (newbyte[1] << 24) + (newbyte[0] << 16) + (newbyte[3] << 8) + newbyte[2];
                    }
                    return(j);
                }
            }
            return(null);
        }
 var(paulis, numerator, power, qubits) = args;
Exemple #14
0
 public base_personnage(santé _Santé, mana _Mana, energie _Energie, poudre _Poudre, vitess _Vitess, armor _Armor, encaissement _Encaissement, speed _Speed, tenacity _Tenacity, range _Range, damage _Damage, power _Power, life_steal _Life_Steal, vampirisme _Vampirisme)
 {
 }
 // Use this for initialization
 void Start()
 {
     //GameObject.Find("EventSystem").GetComponent<scr_ui_multiIcon>().OnRefresh(0);
     anim = GetComponent <Animator>();
     scri = pow.GetComponent <power>();
 }
Exemple #16
0
 var(pauli, numerator, power, qubit) = args;
        public static PlayerCharacter Load(string filename)
        {
            PlayerCharacter pc = new PlayerCharacter();
            XmlDocument doc = new XmlDocument();
            doc.Load(filename);

            //Get Character Details
            XmlNodeList details = doc.SelectNodes("//Details");
            foreach (XmlNode item in details)
            {
                pc.CombatantName = item["name"].InnerText.Trim();
            }

            //Get Powers List
            XmlNodeList powers = doc.SelectNodes("//PowerStats/Power");
            foreach (XmlNode item in powers)
            {
                power p = new power();
                p.name = item.Attributes["name"].InnerText.Trim();
                XmlNodeList spec = item.SelectNodes("specific");
                foreach (XmlNode note in spec)
                {
                    if (note.Attributes["name"].InnerText == "Power Usage")
                    {
                        switch (note.InnerText.Trim())
                        {
                            case "At-Will":
                                p.PowerUsage = power.PowerUsageType.ATWILL;
                                break;
                            case "Encounter":
                            case "Encounter (Special)":
                                p.PowerUsage = power.PowerUsageType.ENCOUNTER;
                                break;
                            case "Daily":
                                p.PowerUsage = power.PowerUsageType.DAILY;
                                break;
                            default:
                                throw new NotImplementedException(note.InnerText.Trim());
                        }
                    }
                    if (note.Attributes["name"].InnerText == "Action Type")
                    {
                        switch (note.InnerText.Trim().ToLower())
                        {
                            case "standard action":
                                p.action = ActionType.STANDARD;
                                break;
                            case "minor action":
                                p.action = ActionType.MINOR;
                                break;
                            case "move action":
                                p.action = ActionType.MOVE;
                                break;
                            case "immediate interrupt":
                                p.action = ActionType.INTERRUPT;
                                break;
                            case "immediate reaction":
                                p.action = ActionType.REACTION;
                                break;
                            default:
                                throw new NotImplementedException(note.InnerText.Trim());
                        }
                    }
                }
                pc.Powers.Add(p);
            }

            //Get Race and Class
            XmlNodeList rules = doc.SelectNodes ("//CharacterSheet/RulesElementTally/RulesElement");
            foreach (XmlNode rule in rules)
            {
                if (rule.Attributes["type"].InnerText == "Race")
                    pc.PlayerRace = rule.Attributes["name"].InnerText;
                if (rule.Attributes["type"].InnerText == "Class")
                    pc.PlayerClass = rule.Attributes["name"].InnerText;
            }

            //Get Stat Block
            XmlNodeList Stats = doc.SelectNodes("//CharacterSheet/StatBlock/Stat");
            foreach (XmlNode stat in Stats)
            {
                attribute a = new attribute();
                a.value = int.Parse(stat.Attributes["value"].InnerText);
                foreach (XmlNode alias in stat.SelectNodes("alias"))
                    a.alias.Add(alias.Attributes["name"].InnerText);
                pc.attList.Add(a);
            }

            foreach (attribute item in pc.attList)
            {
                if (item.att_name == "Hit Points")
                {
                    pc.MaxHP = item.value;
                    pc.CurrentHP = item.value;
                }
                if (item.att_name == "Healing Surges")
                {
                    pc.MaxHealingSurges = item.value;
                    pc.CurrentHealingSurges = item.value;
                }
            }

            doc = null;
            return pc;
        }
    //*********************************//
    // Update is called once per frame //
    //*********************************//
    void Update()
    {
        //float vertical = Input.GetAxis ("Vertical");
        float horizontal = Input.GetAxis ("Horizontal");
        int height = kirbyAnimator.GetInteger ("Height");
        bool moving = kirbyAnimator.GetBool ("Moving");
        bool floating = kirbyAnimator.GetBool ("Floating");
        bool jumping = kirbyAnimator.GetBool ("Jumping");
        bool hopping = kirbyAnimator.GetBool ("Hopping");
        Vector3 position = transform.position;
        if (position.z != -0.2f) {
            position.z = -0.2f;
            transform.position = position;
        }

        if (hopping)
            rigidbody2D.gravityScale = 1;
        else
            rigidbody2D.gravityScale = 0;

        Vector2 vel = rigidbody2D.velocity;
        if (jumping){
            vel.y = Mathf.Min (vel.y + jumpSpeed / 2.0f, jumpSpeed);
        }
        else if (!grounded) {
            if (floating)
                vel.y = Mathf.Max (vel.y + slowFallSpeed / 10.0f, slowFallSpeed);
            else if (hopping) {
                if (hopFlight < 15){
                    hopFlight = hopFlight + 1;
                }
                else {
                    SetHopping (false);
                    initHop = false;
                }
                if (initHop)
                {
                    vel.y = hopSpeed + hopFlight;
                    initHop = false;
                }

                if (vel.y <= 0){
                    SetFalling (true);
                }
            }
            else {
                if (vel.y <= 0){
                    SetFalling (true);
                }
                vel.y -= hopSpeed * Time.deltaTime * 2.6f;
            }
        } else {
            vel.y = slowFallSpeed;
        }

        if (height == 0) {
            if (moving) {
                if (floating)
                    vel.x = horizontal * slowSpeed;
                else
                    vel.x = horizontal * speed;
            } else{
                vel.x = 0;
            }
        } else if (height == -1) {
            if (vel.x > 0.1f){
                vel.x = vel.x - drift;
            }
            else if (vel.x < -0.1f){
                vel.x = vel.x + drift;
            }
            else {
                vel.x = 0;
                SetMoving(false);
            }
        } else if (height == 1) {
            if (moving)
                vel.x = horizontal * slowSpeed;
            else
                vel.x = 0;
        } else {
            // This is when you're HOP-JUMPING, not when you're standing still
            vel.x = horizontal * speed;
        }
        if (usingPower == false) {
            if (currentPower != power.none)
                haltPowers ();
        } else {
            vel.x = 0f;
        }

        // Assume NOT using power
        usingPower = false;

        // If you don't hold the hop button, you stop hopping; if you land, you aren't hopping.
        if (hopping && !Input.GetKey(KeyCode.Z)) {
            SetHopping (false);
            hopping = false;
        }
        if ((height == -1) && !Input.GetKey (KeyCode.DownArrow) && grounded){
            SetHeight (0);
        }

        if (!Input.GetKey (KeyCode.X) || Input.GetKey (KeyCode.UpArrow)) {
            // No perma inhale
            haltPowers();
        }

        // Set height and moving parameters
        if ((Input.GetKey (KeyCode.DownArrow) && Input.GetKey ( KeyCode.UpArrow)) ||
            (Input.GetKey (KeyCode.LeftArrow) && Input.GetKey ( KeyCode.RightArrow)))
        {
            // Pressing conflicting keys
            SetMoving (false);
        }
        else if (Input.GetKey (KeyCode.DownArrow) && !Input.GetKey (KeyCode.X) && grounded)
        {
            // Pressing down only, still can't move though
            SetHeight (-1);
            Vector3 scale = transform.localScale;
            // Flip the model if you move in a different direction
            // than where you were previously facing
            if ((Input.GetKey (KeyCode.RightArrow) && direction == 0) ||
                (Input.GetKey (KeyCode.LeftArrow) && direction == 1))
            {
                if (height != -1)
                {
                    scale.x *= -1;
                    direction = Mathf.Abs(direction - 1);
                }
            }
            transform.localScale = scale;
        }
        else if (Input.GetKey (KeyCode.X) && !Input.GetKey (KeyCode.UpArrow) && floating)
        {
            if (floating){
                SetFloating (false);
                SetJumping (false);
            }
        } else if ((Input.GetKeyDown (KeyCode.X) || (Input.GetKey (KeyCode.X) && !powerInterrupt))&& !Input.GetKey (KeyCode.UpArrow)) {
            if (Input.GetKey (KeyCode.DownArrow)) {
                //PUT SLIDE-KICK CODE HERE!
                SetHeight (-1); // It should be already, but there's a glitch.
            } else {
                powerInterrupt = false;
                usingPower = true;
                SetMoving (false);
                UsePower(currentPower);
            }
        }
        else if (Input.GetKey (KeyCode.UpArrow) || (Input.GetKey (KeyCode.Z) && floating))
        {
            if (overDoor == true)
            {
                ChangePosX(83f);
                overDoor = false;
            } else if (overBackDoor == true)
            {
                ChangePosX(-83.0f);
                overBackDoor = false;
            } else {
                SetHeight (1);
                grounded = false;
                SetFloating (true);
                SetJumping (true);
                SetFalling (false);
                if (Input.GetKey (KeyCode.RightArrow) || Input.GetKey (KeyCode.LeftArrow))
                {
                    // SetMoving left or right
                    SetMoving (true);
                    Vector3 scale = transform.localScale;
                    // Flip the model if you move in a different direction
                    // than where you were previously facing
                    if ((Input.GetKey (KeyCode.RightArrow) && direction == 0) ||
                        (Input.GetKey (KeyCode.LeftArrow) && direction == 1))
                    {
                        if (height != -1)
                        {
                            scale.x *= -1;
                            direction = Mathf.Abs(direction - 1);
                        }
                    }
                    transform.localScale = scale;
                } else {
                    SetMoving (false);
                }
            }
        }
        else if (Input.GetKeyDown (KeyCode.Z) && !floating && grounded) {
            SetJumping (false);
            SetHopping (true);
            SetFalling (false);
            SetHeight (2);
            hopping = true;
            grounded = false;
            initHop = true;
            hopFlight = 1;
        }
        else if (Input.GetKey (KeyCode.RightArrow) || Input.GetKey (KeyCode.LeftArrow))
        {
            // SetMoving left or right
            SetMoving (true);
            SetJumping (false);

            Vector3 scale = transform.localScale;
            // Flip the model if you move in a different direction
            // than where you were previously facing
            if ((Input.GetKey (KeyCode.RightArrow) && direction == 0) ||
                (Input.GetKey (KeyCode.LeftArrow) && direction == 1))
            {
                if (height != -1)
                {
                    scale.x *= -1;
                    direction = Mathf.Abs(direction - 1);
                }
            }
            transform.localScale = scale;
        }
        else
        {
            // Not pressing anything, still shouldn't move
            SetMoving (false);
            SetJumping (false);
        }
        if (Input.GetKey (KeyCode.Space))
        {
            currentPower = power.none;
            haltPowers();
        }

        rigidbody2D.velocity = vel;
    }
 void UsePower(power usedPower)
 {
     switch (usedPower)
     {
         case power.none:
             noPower.SetActive(true);
             break;
         case power.beam:
             beamPower.SetActive(true);
             break;
         case power.electric:
             electricPower.SetActive(true);
             break;
         case power.fire:
             firePower.SetActive(true);
             break;
     }
 }