Пример #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (EncounterId != 0UL)
            {
                hash ^= EncounterId.GetHashCode();
            }
            if (Pokeball != 0)
            {
                hash ^= Pokeball.GetHashCode();
            }
            if (NormalizedReticleSize != 0D)
            {
                hash ^= NormalizedReticleSize.GetHashCode();
            }
            if (SpawnPointId.Length != 0)
            {
                hash ^= SpawnPointId.GetHashCode();
            }
            if (HitPokemon != false)
            {
                hash ^= HitPokemon.GetHashCode();
            }
            if (SpinModifier != 0D)
            {
                hash ^= SpinModifier.GetHashCode();
            }
            if (NormalizedHitPosition != 0D)
            {
                hash ^= NormalizedHitPosition.GetHashCode();
            }
            return(hash);
        }
Пример #2
0
        public void BuyTest()
        {
            Player   player   = new Player(null, 0, null, 300, 0, 0, null, new List <Item>(), new List <Pokemon>(), 0, 0, null);
            Pokeball pokeball = new Pokeball(1, "pokeball", 200, "het is een pokeball", 00);

            player.BuyItem(pokeball, 1);
            Assert.AreEqual(100, player.Money);
            Assert.AreEqual(1, player.Inventory.Count);
        }
Пример #3
0
        public void sellTest()
        {
            Player   player   = new Player(null, 0, null, 0, 0, 0, null, new List <Item>(), new List <Pokemon>(), 0, 0, null);
            Pokeball pokeball = new Pokeball(1, "pokeball", 300, "het is een pokeball", 00);

            player.GiveItem(pokeball);
            player.SellItem(pokeball, 1);
            //assert
            Assert.AreEqual(300, player.Money);
        }
Пример #4
0
    public void OnCollisionEnter(Collision collision)
    {
        Pokeball hitBall = collision.gameObject.GetComponent <Pokeball>();

        if (hitBall != null && collision.relativeVelocity.magnitude >= 1)
        {
            Debug.Log("Hit by pokeball");
            pokeAnimator.enabled = true;
            pokeAnimator.SetBool("catch", true);
            hitBall.CatchAnimation();
            Destroy(this.gameObject, .5f);
        }
    }
Пример #5
0
    public ItemList(XmlReader reader)
    {
        while (reader.Read())
        {
            if (reader.NodeType == XmlNodeType.Element && reader.Name == "inventoryItem")
            {
                int           type = int.Parse(reader.GetAttribute("Type"));
                inventoryItem item; //can be overwritten by the switch

                # region switch (type)
                switch (type)
                {
                case 1:     //medicine
                    item = new RecoveryItem();
                    break;

                case 2:     //pokeball
                    item       = new Pokeball();
                    item.Power = double.Parse(reader.GetAttribute("Power"));
                    break;

                case 3:     //TM
                    item = new TMItem();
                    break;

                case 4:     //berry
                    item = new Berry();
                    break;

                case 5:                    //holdable item
                    //item = new MainItem();
                    item = new HoldItem(); //still returns "MainItem"";
                    break;

                case 6:     //key item
                    item = new KeyItem();
                    break;

                default:
                    item = new inventoryItem();
                    break;
                }
                # endregion

                item.ID          = reader.GetAttribute("ID");
                item.Name        = reader.GetAttribute("Name");
                item.type        = type;
                item.Description = reader.ReadElementString();

                items.Add(item.ID, item);
            }
Пример #6
0
        public IActionResult Pokeball(int id)
        {
            Pokeball pokeball            = this.dataService.GetPokeball(id);
            PokeballAdminViewModel model = new PokeballAdminViewModel()
            {
                AllGenerations = this.dataService.GetObjects <Generation>(),
                Id             = pokeball.Id,
                Name           = pokeball.Name,
                GenerationId   = pokeball.GenerationId,
                Generation     = pokeball.Generation,
            };

            return(this.View(model));
        }
Пример #7
0
    public void AddPokeballToInventory()
    {
        foreach (Pokeball ball in m_Pball)
        {
            if (!ball.m_IsInInventory)
            {
                ball.m_IsInInventory = true;
                m_Inventory.AddItem(ball);
                return;
            }
        }
        Pokeball p = new Pokeball();

        p.m_IsInInventory = true;
        m_Pball.Add(p);
        m_Inventory.AddItem(p);
    }
Пример #8
0
    public void CapturePokemon()
    {
        Pokeball pokeball = this.gameObject.AddComponent <Pokeball> ();
        //Vector3 pokemonPositon = pokemonObj.transform.position;
        Vector3    pokemonPositon = pokemon.obj.enemy.transform.position;
        GameObject ball           = (GameObject)Instantiate(Resources.Load("Pokeball"));

        //ball.transform.position = GameObject.Find("_PokeballHolder").transform.position;
        GameObject.Find("_PokeballHolder").transform.LookAt(pokemonPositon);
        ball.transform.position = GameObject.Find("_PokeballHolder").transform.position;
        //ball.rigidbody.AddForce
        //	( Camera.main.transform.forward*500+ Camera.main.transform.up*300 );
        ball.rigidbody.AddForce(pokemonPositon * 500 + Camera.main.transform.up * 300);
        //Pokeball.CapturePokemon();
        pokeball.CapturePokemon();
        Destroy(ball, 1);
        Destroy(pokeball);
    }
Пример #9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (EncounterId != 0UL)
            {
                hash ^= EncounterId.GetHashCode();
            }
            if (Pokeball != 0)
            {
                hash ^= Pokeball.GetHashCode();
            }
            if (NormalizedReticleSize != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(NormalizedReticleSize);
            }
            if (SpawnPointId.Length != 0)
            {
                hash ^= SpawnPointId.GetHashCode();
            }
            if (HitPokemon != false)
            {
                hash ^= HitPokemon.GetHashCode();
            }
            if (SpinModifier != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(SpinModifier);
            }
            if (NormalizedHitPosition != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(NormalizedHitPosition);
            }
            if (arPlusValues_ != null)
            {
                hash ^= ArPlusValues.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #10
0
        private IEnumerator PokeballTurn(Pokeball pokeball)
        {
            var succes = _battle.UseItem(pokeball, _battle.WildPokemon);

            _textPanel.SetActive(true);
            if (succes)
            {
                _textPanel.transform.Find("Text").gameObject.GetComponent <Text>().text =
                    "You caught " + _battle.WildPokemon.Name + "!\nI hope you are happy";
                _battle.Player.CatchPokemon(_battle.WildPokemon);
                yield return(WaitForInput());
            }
            else
            {
                _textPanel.transform.Find("Text").gameObject.GetComponent <Text>().text =
                    "You failed.\nJust like the rest of your life!";
                yield return(WaitForInput());

                yield return(EnemyMoveEndTurn());
            }
        }
Пример #11
0
        public void MasterballTest()
        {
            ItemStore it = new ItemStore();

            Pokeball mBall = (Pokeball)(it.get(ItemName.MasterBall));

            Pokemon pMon    = new Pokemon(-80, "", 100, Pokemon.PokeType.Bug, Pokemon.PokeType.Bug, null, 106, 106, 110, 90, 154, 90, 130, 3);
            bool    correct = true;

            for (int i = 0; i < 100000; ++i)
            {
                if (!pMon.ThrowBall(mBall))
                {
                    Trace.WriteLine(pMon.captureRate);
                    correct = false;
                    break;
                }
            }

            Assert.AreEqual(correct, true);
        }
Пример #12
0
 public void MergeFrom(TradingPokemon other)
 {
     if (other == null)
     {
         return;
     }
     if (other.PokemonId != 0UL)
     {
         PokemonId = other.PokemonId;
     }
     if (other.PokedexEntryNumber != 0)
     {
         PokedexEntryNumber = other.PokedexEntryNumber;
     }
     if (other.OriginalCp != 0)
     {
         OriginalCp = other.OriginalCp;
     }
     if (other.AdjustedCpMin != 0)
     {
         AdjustedCpMin = other.AdjustedCpMin;
     }
     if (other.AdjustedCpMax != 0)
     {
         AdjustedCpMax = other.AdjustedCpMax;
     }
     if (other.OriginalStamina != 0)
     {
         OriginalStamina = other.OriginalStamina;
     }
     if (other.AdjustedStaminaMin != 0)
     {
         AdjustedStaminaMin = other.AdjustedStaminaMin;
     }
     if (other.AdjustedStaminaMax != 0)
     {
         AdjustedStaminaMax = other.AdjustedStaminaMax;
     }
     if (other.FriendLevelCap != false)
     {
         FriendLevelCap = other.FriendLevelCap;
     }
     if (other.Move1 != 0)
     {
         Move1 = other.Move1;
     }
     if (other.Move2 != 0)
     {
         Move2 = other.Move2;
     }
     if (other.pokemonDisplay_ != null)
     {
         if (pokemonDisplay_ == null)
         {
             pokemonDisplay_ = new global::POGOProtos.Data.PokemonDisplay();
         }
         PokemonDisplay.MergeFrom(other.PokemonDisplay);
     }
     if (other.CapturedS2CellId != 0L)
     {
         CapturedS2CellId = other.CapturedS2CellId;
     }
     if (other.tradedPokemon_ != null)
     {
         if (tradedPokemon_ == null)
         {
             tradedPokemon_ = new global::POGOProtos.Data.PokemonData();
         }
         TradedPokemon.MergeFrom(other.TradedPokemon);
     }
     if (other.pokeball_ != null)
     {
         if (pokeball_ == null)
         {
             pokeball_ = new global::POGOProtos.Inventory.Item.ItemData();
         }
         Pokeball.MergeFrom(other.Pokeball);
     }
     if (other.IndividualAttack != 0)
     {
         IndividualAttack = other.IndividualAttack;
     }
     if (other.IndividualDefense != 0)
     {
         IndividualDefense = other.IndividualDefense;
     }
     if (other.IndividualStamina != 0)
     {
         IndividualStamina = other.IndividualStamina;
     }
     if (other.Nickname.Length != 0)
     {
         Nickname = other.Nickname;
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Пример #13
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0UL)
            {
                hash ^= Id.GetHashCode();
            }
            if (PokemonId != 0)
            {
                hash ^= PokemonId.GetHashCode();
            }
            if (Cp != 0)
            {
                hash ^= Cp.GetHashCode();
            }
            if (Stamina != 0)
            {
                hash ^= Stamina.GetHashCode();
            }
            if (StaminaMax != 0)
            {
                hash ^= StaminaMax.GetHashCode();
            }
            if (Move1 != 0)
            {
                hash ^= Move1.GetHashCode();
            }
            if (Move2 != 0)
            {
                hash ^= Move2.GetHashCode();
            }
            if (DeployedFortId.Length != 0)
            {
                hash ^= DeployedFortId.GetHashCode();
            }
            if (OwnerName.Length != 0)
            {
                hash ^= OwnerName.GetHashCode();
            }
            if (IsEgg != false)
            {
                hash ^= IsEgg.GetHashCode();
            }
            if (EggKmWalkedTarget != 0D)
            {
                hash ^= EggKmWalkedTarget.GetHashCode();
            }
            if (EggKmWalkedStart != 0D)
            {
                hash ^= EggKmWalkedStart.GetHashCode();
            }
            if (Origin != 0)
            {
                hash ^= Origin.GetHashCode();
            }
            if (HeightM != 0F)
            {
                hash ^= HeightM.GetHashCode();
            }
            if (WeightKg != 0F)
            {
                hash ^= WeightKg.GetHashCode();
            }
            if (IndividualAttack != 0)
            {
                hash ^= IndividualAttack.GetHashCode();
            }
            if (IndividualDefense != 0)
            {
                hash ^= IndividualDefense.GetHashCode();
            }
            if (IndividualStamina != 0)
            {
                hash ^= IndividualStamina.GetHashCode();
            }
            if (CpMultiplier != 0F)
            {
                hash ^= CpMultiplier.GetHashCode();
            }
            if (Pokeball != 0)
            {
                hash ^= Pokeball.GetHashCode();
            }
            if (CapturedCellId != 0UL)
            {
                hash ^= CapturedCellId.GetHashCode();
            }
            if (BattlesAttacked != 0)
            {
                hash ^= BattlesAttacked.GetHashCode();
            }
            if (BattlesDefended != 0)
            {
                hash ^= BattlesDefended.GetHashCode();
            }
            if (EggIncubatorId.Length != 0)
            {
                hash ^= EggIncubatorId.GetHashCode();
            }
            if (CreationTimeMs != 0UL)
            {
                hash ^= CreationTimeMs.GetHashCode();
            }
            if (NumUpgrades != 0)
            {
                hash ^= NumUpgrades.GetHashCode();
            }
            if (AdditionalCpMultiplier != 0F)
            {
                hash ^= AdditionalCpMultiplier.GetHashCode();
            }
            if (Favorite != 0)
            {
                hash ^= Favorite.GetHashCode();
            }
            if (Nickname.Length != 0)
            {
                hash ^= Nickname.GetHashCode();
            }
            if (FromFort != 0)
            {
                hash ^= FromFort.GetHashCode();
            }
            if (BuddyCandyAwarded != 0)
            {
                hash ^= BuddyCandyAwarded.GetHashCode();
            }
            if (BuddyTotalKmWalked != 0F)
            {
                hash ^= BuddyTotalKmWalked.GetHashCode();
            }
            if (DisplayPokemonId != 0)
            {
                hash ^= DisplayPokemonId.GetHashCode();
            }
            if (DisplayCp != 0)
            {
                hash ^= DisplayCp.GetHashCode();
            }
            return(hash);
        }
Пример #14
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ItemId != 0)
            {
                hash ^= ItemId.GetHashCode();
            }
            if (ItemType != 0)
            {
                hash ^= ItemType.GetHashCode();
            }
            if (Category != 0)
            {
                hash ^= Category.GetHashCode();
            }
            if (DropFreq != 0F)
            {
                hash ^= DropFreq.GetHashCode();
            }
            if (DropTrainerLevel != 0)
            {
                hash ^= DropTrainerLevel.GetHashCode();
            }
            if (pokeball_ != null)
            {
                hash ^= Pokeball.GetHashCode();
            }
            if (potion_ != null)
            {
                hash ^= Potion.GetHashCode();
            }
            if (revive_ != null)
            {
                hash ^= Revive.GetHashCode();
            }
            if (battle_ != null)
            {
                hash ^= Battle.GetHashCode();
            }
            if (food_ != null)
            {
                hash ^= Food.GetHashCode();
            }
            if (inventoryUpgrade_ != null)
            {
                hash ^= InventoryUpgrade.GetHashCode();
            }
            if (xpBoost_ != null)
            {
                hash ^= XpBoost.GetHashCode();
            }
            if (incense_ != null)
            {
                hash ^= Incense.GetHashCode();
            }
            if (eggIncubator_ != null)
            {
                hash ^= EggIncubator.GetHashCode();
            }
            if (fortModifier_ != null)
            {
                hash ^= FortModifier.GetHashCode();
            }
            return(hash);
        }
Пример #15
0
    public Vector3 Touched(Pokeball ball)
    {
        // Returns the position the Pokeball should bounce back at.

        /// The next steps are the following:
        /// - the Pokémon brakes until it's frozen (can be frozen mid-air).
        /// - meanwhile, the Pokéball bounces back and turns to face the Pokémon.
        /// - once the pokeball is in position, the pokeball opens and the pokemon turns into red energy.
        /// - I'd like to keep the white flash light at the moment.
        /// - the pokeball closes once all the energy is inside.
        /// - then we proceed normally with the fall followed shaking.
        /// - note: I'll need to manage the breakout of the pokeball once I'll be able to pick some more from my back.

        Debug.Log("Touched method called.");

        if (_homeBall != null)
        {
            // You can't capture someone else's Pokémon!
            return Vector3.zero;
        }

        _state = PokemonState.Touched;
        _homeBall = ball;
        _isBeingCaptured = true;

        //_emissionOriginalColor = _rend.material.GetColor("_EmissionColor");
        //_emissionTargetColor = Color.white;

        // Calculating the bounce destination. A ajuster.
        Vector3 destination = ball.transform.position - _tr.position;
        destination.y = 0;
        //destination.Normalize();

        Bounds bounds = _rend.bounds;
        destination.y = ball.transform.position.y + Mathf.Max(0.6f, bounds.extents.y); // Rajouter une telle hauteur va faire traverser les Pokémons volants au dessus du joueur à la Pokéball.

        return destination;
    }
Пример #16
0
 public void MergeFrom(ItemSettings other)
 {
     if (other == null)
     {
         return;
     }
     if (other.ItemId != 0)
     {
         ItemId = other.ItemId;
     }
     if (other.ItemType != 0)
     {
         ItemType = other.ItemType;
     }
     if (other.Category != 0)
     {
         Category = other.Category;
     }
     if (other.DropFreq != 0F)
     {
         DropFreq = other.DropFreq;
     }
     if (other.DropTrainerLevel != 0)
     {
         DropTrainerLevel = other.DropTrainerLevel;
     }
     if (other.pokeball_ != null)
     {
         if (pokeball_ == null)
         {
             pokeball_ = new global::PokemonGoDesktop.API.Proto.PokeballAttributes();
         }
         Pokeball.MergeFrom(other.Pokeball);
     }
     if (other.potion_ != null)
     {
         if (potion_ == null)
         {
             potion_ = new global::PokemonGoDesktop.API.Proto.PotionAttributes();
         }
         Potion.MergeFrom(other.Potion);
     }
     if (other.revive_ != null)
     {
         if (revive_ == null)
         {
             revive_ = new global::PokemonGoDesktop.API.Proto.ReviveAttributes();
         }
         Revive.MergeFrom(other.Revive);
     }
     if (other.battle_ != null)
     {
         if (battle_ == null)
         {
             battle_ = new global::PokemonGoDesktop.API.Proto.BattleAttributes();
         }
         Battle.MergeFrom(other.Battle);
     }
     if (other.food_ != null)
     {
         if (food_ == null)
         {
             food_ = new global::PokemonGoDesktop.API.Proto.FoodAttributes();
         }
         Food.MergeFrom(other.Food);
     }
     if (other.inventoryUpgrade_ != null)
     {
         if (inventoryUpgrade_ == null)
         {
             inventoryUpgrade_ = new global::PokemonGoDesktop.API.Proto.InventoryUpgradeAttributes();
         }
         InventoryUpgrade.MergeFrom(other.InventoryUpgrade);
     }
     if (other.xpBoost_ != null)
     {
         if (xpBoost_ == null)
         {
             xpBoost_ = new global::PokemonGoDesktop.API.Proto.ExperienceBoostAttributes();
         }
         XpBoost.MergeFrom(other.XpBoost);
     }
     if (other.incense_ != null)
     {
         if (incense_ == null)
         {
             incense_ = new global::PokemonGoDesktop.API.Proto.IncenseAttributes();
         }
         Incense.MergeFrom(other.Incense);
     }
     if (other.eggIncubator_ != null)
     {
         if (eggIncubator_ == null)
         {
             eggIncubator_ = new global::PokemonGoDesktop.API.Proto.EggIncubatorAttributes();
         }
         EggIncubator.MergeFrom(other.EggIncubator);
     }
     if (other.fortModifier_ != null)
     {
         if (fortModifier_ == null)
         {
             fortModifier_ = new global::PokemonGoDesktop.API.Proto.FortModifierAttributes();
         }
         FortModifier.MergeFrom(other.FortModifier);
     }
 }
Пример #17
0
        public IActionResult Pokeball(Pokeball pokeball)
        {
            this.dataService.DeletePokeball(pokeball.Id);

            return(this.RedirectToAction("Pokeballs", "Admin"));
        }
Пример #18
0
    public void Swallow(Pokeball ball)
    {
        _state = PokemonState.Swallowed;

        _hologram.GetComponent<MeshReductor>().StartShrinking(_homeBall.transform);

        _captureTime = Time.time;
        _anim.speed = 0f; // Freezes the Pokemon.
        _nav.enabled = false;

        // Calculating the shrinking ratio for the Pokémon to fit within the Pokéball.
        Bounds bounds = _rend.bounds;
        float diagonal = bounds.size.magnitude; // La magnitude de la taille de la bounding box représente la diagonale de cette boite et est un bon indicateur du volume du personne.
        _shrinkingRatio = Mathf.Sqrt(0.018252f) / diagonal; // Attention aux divisions par 0 ! Racine de 0.018252 est la diagonale de la bounding box de la pokeball.

        _pathToBall = _tr.position - ball.transform.position;
    }
Пример #19
0
 public void MergeFrom(ItemSettings other)
 {
     if (other == null)
     {
         return;
     }
     if (other.ItemId != 0)
     {
         ItemId = other.ItemId;
     }
     if (other.ItemType != 0)
     {
         ItemType = other.ItemType;
     }
     if (other.Category != 0)
     {
         Category = other.Category;
     }
     if (other.DropFreq != 0F)
     {
         DropFreq = other.DropFreq;
     }
     if (other.DropTrainerLevel != 0)
     {
         DropTrainerLevel = other.DropTrainerLevel;
     }
     if (other.pokeball_ != null)
     {
         if (pokeball_ == null)
         {
             pokeball_ = new global::POGOProtos.Settings.Master.Item.PokeballAttributes();
         }
         Pokeball.MergeFrom(other.Pokeball);
     }
     if (other.potion_ != null)
     {
         if (potion_ == null)
         {
             potion_ = new global::POGOProtos.Settings.Master.Item.PotionAttributes();
         }
         Potion.MergeFrom(other.Potion);
     }
     if (other.revive_ != null)
     {
         if (revive_ == null)
         {
             revive_ = new global::POGOProtos.Settings.Master.Item.ReviveAttributes();
         }
         Revive.MergeFrom(other.Revive);
     }
     if (other.battle_ != null)
     {
         if (battle_ == null)
         {
             battle_ = new global::POGOProtos.Settings.Master.Item.BattleAttributes();
         }
         Battle.MergeFrom(other.Battle);
     }
     if (other.food_ != null)
     {
         if (food_ == null)
         {
             food_ = new global::POGOProtos.Settings.Master.Item.FoodAttributes();
         }
         Food.MergeFrom(other.Food);
     }
     if (other.inventoryUpgrade_ != null)
     {
         if (inventoryUpgrade_ == null)
         {
             inventoryUpgrade_ = new global::POGOProtos.Settings.Master.Item.InventoryUpgradeAttributes();
         }
         InventoryUpgrade.MergeFrom(other.InventoryUpgrade);
     }
     if (other.xpBoost_ != null)
     {
         if (xpBoost_ == null)
         {
             xpBoost_ = new global::POGOProtos.Settings.Master.Item.ExperienceBoostAttributes();
         }
         XpBoost.MergeFrom(other.XpBoost);
     }
     if (other.incense_ != null)
     {
         if (incense_ == null)
         {
             incense_ = new global::POGOProtos.Settings.Master.Item.IncenseAttributes();
         }
         Incense.MergeFrom(other.Incense);
     }
     if (other.eggIncubator_ != null)
     {
         if (eggIncubator_ == null)
         {
             eggIncubator_ = new global::POGOProtos.Settings.Master.Item.EggIncubatorAttributes();
         }
         EggIncubator.MergeFrom(other.EggIncubator);
     }
     if (other.fortModifier_ != null)
     {
         if (fortModifier_ == null)
         {
             fortModifier_ = new global::POGOProtos.Settings.Master.Item.FortModifierAttributes();
         }
         FortModifier.MergeFrom(other.FortModifier);
     }
     if (other.stardustBoost_ != null)
     {
         if (stardustBoost_ == null)
         {
             stardustBoost_ = new global::POGOProtos.Settings.Master.Item.StardustBoostAttributes();
         }
         StardustBoost.MergeFrom(other.StardustBoost);
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Пример #20
0
    void Key()
    {
        direction = Vector2.zero;
        dir       = 0;
        if (Input.GetKey(rigth))
        {
            dir       = 3;
            direction = Vector2.right;
        }
        if (Input.GetKey(left))
        {
            dir       = 2;
            direction = -Vector2.right;
        }
        if (Input.GetKey(up))
        {
            dir       = 4;
            direction = Vector2.up;
        }
        if (Input.GetKey(down))
        {
            direction = -Vector2.up;
            dir       = 1;
        }
        if (isPlayer1)
        {
            if (Input.GetKeyDown(fire))
            {
                if (GameManager.pokemonPlayer1.gameObject.name == "Voltorb")
                {
                    if (havePokeball)
                    {
                        pb = (Pokeball)Instantiate(pokeball, transform.position, Quaternion.identity);
                        pb.player1Instance = true;
                        AudioSource.PlayClipAtPoint(clip2, Camera.main.transform.position);
                        StartCoroutine("Wait");
                    }
                }
                else
                {
                    pb = (Pokeball)Instantiate(pokeball, transform.position, Quaternion.identity);
                    AudioSource.PlayClipAtPoint(clip2, Camera.main.transform.position);
                    pb.player1Instance = true;
                }
            }
        }
        else
        {
            if (Input.GetKeyDown(fire) || Input.GetKeyDown(KeyCode.KeypadEnter))
            {
                if (GameManager.pokemonPlayer2.gameObject.name == "Voltorb")
                {
                    if (havePokeball)
                    {
                        pb = (Pokeball)Instantiate(pokeball, transform.position, Quaternion.identity);
                        AudioSource.PlayClipAtPoint(clip2, Camera.main.transform.position);
                        pb.player1Instance = false;
                        StartCoroutine("Wait");
                    }
                }
                else
                {
                    pb = (Pokeball)Instantiate(pokeball, transform.position, Quaternion.identity);
                    AudioSource.PlayClipAtPoint(clip2, Camera.main.transform.position);
                    pb.player1Instance = false;
                }
            }
        }

        if (isPlayer1)
        {
            if (Input.GetKeyDown(escape) && GameManager.pokemonPlayer1.gameObject.name != "Voltorb")
            {
                GameManager.pokemonPlayer1 = null;
            }
        }
        else
        {
            if (Input.GetKeyDown(escape) && GameManager.pokemonPlayer2.gameObject.name != "Voltorb")
            {
                GameManager.pokemonPlayer2 = null;
            }
        }
    }
Пример #21
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (PokemonId != 0UL)
            {
                hash ^= PokemonId.GetHashCode();
            }
            if (PokedexEntryNumber != 0)
            {
                hash ^= PokedexEntryNumber.GetHashCode();
            }
            if (OriginalCp != 0)
            {
                hash ^= OriginalCp.GetHashCode();
            }
            if (AdjustedCpMin != 0)
            {
                hash ^= AdjustedCpMin.GetHashCode();
            }
            if (AdjustedCpMax != 0)
            {
                hash ^= AdjustedCpMax.GetHashCode();
            }
            if (OriginalStamina != 0)
            {
                hash ^= OriginalStamina.GetHashCode();
            }
            if (AdjustedStaminaMin != 0)
            {
                hash ^= AdjustedStaminaMin.GetHashCode();
            }
            if (AdjustedStaminaMax != 0)
            {
                hash ^= AdjustedStaminaMax.GetHashCode();
            }
            if (FriendLevelCap != false)
            {
                hash ^= FriendLevelCap.GetHashCode();
            }
            if (Move1 != 0)
            {
                hash ^= Move1.GetHashCode();
            }
            if (Move2 != 0)
            {
                hash ^= Move2.GetHashCode();
            }
            if (pokemonDisplay_ != null)
            {
                hash ^= PokemonDisplay.GetHashCode();
            }
            if (CapturedS2CellId != 0L)
            {
                hash ^= CapturedS2CellId.GetHashCode();
            }
            if (tradedPokemon_ != null)
            {
                hash ^= TradedPokemon.GetHashCode();
            }
            if (pokeball_ != null)
            {
                hash ^= Pokeball.GetHashCode();
            }
            if (IndividualAttack != 0)
            {
                hash ^= IndividualAttack.GetHashCode();
            }
            if (IndividualDefense != 0)
            {
                hash ^= IndividualDefense.GetHashCode();
            }
            if (IndividualStamina != 0)
            {
                hash ^= IndividualStamina.GetHashCode();
            }
            if (Nickname.Length != 0)
            {
                hash ^= Nickname.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #22
0
    public void Play(Pokeball pokeball)
    {
        _isEmitting = true;

        _pokeball = pokeball;

        //_tr.SetParent(parent);
        //_rigid.velocity = Vector3.zero;
        _length = 0f;
        _rend.enabled = true;
    }
Пример #23
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ItemId != 0)
            {
                hash ^= ItemId.GetHashCode();
            }
            if (ItemType != 0)
            {
                hash ^= ItemType.GetHashCode();
            }
            if (Category != 0)
            {
                hash ^= Category.GetHashCode();
            }
            if (DropFreq != 0F)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(DropFreq);
            }
            if (DropTrainerLevel != 0)
            {
                hash ^= DropTrainerLevel.GetHashCode();
            }
            if (pokeball_ != null)
            {
                hash ^= Pokeball.GetHashCode();
            }
            if (potion_ != null)
            {
                hash ^= Potion.GetHashCode();
            }
            if (revive_ != null)
            {
                hash ^= Revive.GetHashCode();
            }
            if (battle_ != null)
            {
                hash ^= Battle.GetHashCode();
            }
            if (food_ != null)
            {
                hash ^= Food.GetHashCode();
            }
            if (inventoryUpgrade_ != null)
            {
                hash ^= InventoryUpgrade.GetHashCode();
            }
            if (xpBoost_ != null)
            {
                hash ^= XpBoost.GetHashCode();
            }
            if (incense_ != null)
            {
                hash ^= Incense.GetHashCode();
            }
            if (eggIncubator_ != null)
            {
                hash ^= EggIncubator.GetHashCode();
            }
            if (fortModifier_ != null)
            {
                hash ^= FortModifier.GetHashCode();
            }
            if (stardustBoost_ != null)
            {
                hash ^= StardustBoost.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #24
0
    // Update is called once per frame
    void Update()
    {
        if (GameData.instance.atTitleScreen)
        {
            return;
        }
        StartCoroutine(MovementUpdate());
        movingHitbox.transform.position = targetPos;


        disabled = isDisabled;
        playerAnim.SetFloat("walkbikesurfstate", (int)walkSurfBikeState);
        if (viewBio.bioscreen.enabled)
        {
            isDisabled = true;
        }


        if (!isDisabled && !menuActive && !startMenuActive)
        {
            if (Inputs.pressed("start") && !isMoving)
            {
                SoundManager.instance.sfx.PlayOneShot(openStartMenuClip);
                startMenuActive = true;
                mainMenu.gameObject.SetActive(true);
                mainMenu.Initialize();
            }
            top.SetActive(!isDisabled);
            bottom.SetActive(!isDisabled);

            playerAnim.SetInteger("movedirection", (int)direction + 1);

            if (Inputs.released("down") || Inputs.released("right") || Inputs.released("left") || Inputs.released("up"))
            {
                if (!manuallyWalking)
                {
                    holdingDirection = false;
                }
            }
        }


        if (facedObject != null)
        {
            NPC npc = null;
            if (facedObject != null)
            {
                npc = facedObject.GetComponent <NPC>();
            }
            if (!holdingDirection && transform.position == targetPos)
            {
                if (!holdingDirection && !isMoving && !isDisabled && Dialogue.instance.finishedText && !startMenuActive && !menuActive && !inBattle && !ledgejumping)
                {
                    if (Inputs.pressed("a"))
                    {
                        if (npc != null && !npc.isMoving)
                        {
                            npc.FacePlayer();
                            if (npc.isTrainer)
                            {
                                npc.StartEncounter();
                            }
                            else
                            {
                                StartCoroutine(npc.NPCText());
                            }
                            return;
                        }
                        if (facedObject != null)
                        {
                            switch (facedObject.tag) //what tag does the interactable object have?
                            {
                            case "Slots":
                                SlotsObject dialogueSlots = facedObject.GetComponent <SlotsObject>();
                                StartCoroutine(dialogueSlots.PlayDialogue());
                                return;

                            case "Pokeball":
                                Pokeball pokeball = facedObject.GetComponent <Pokeball>();
                                pokeball.GetItem(pokeball.item);
                                return;
                            }
                        }
                    }
                }
            }
        }
        CheckObjectCollision();
    }
Пример #25
0
 void Start()
 {
     gameSession = FindObjectOfType <GameSession>();
     pokeball    = FindObjectOfType <Pokeball>();
 }
Пример #26
0
    public void ReleaseFromPokeball()
    {
        _state = PokemonState.BeingReleased;

        _tr.localScale = Vector3.one / 100000f;
        _anim.speed = 1f;
        _nav.enabled = true;
        _nav.speed = _defaultAgentSpeed;
        _nav.angularSpeed = _defaultAgentAngularSpeed;

        _skinnedMesh.enabled = true;
        _rend.material.SetColor("_EmissionColor", Color.white);
        _emissionOriginalColor = Color.white;
        _emissionTargetColor = Color.white;

        if (_deformation != null)
        {
            if (_deformation._animator == null)
            {
                _deformation._animator = _anim;
            }

            _deformation.LaunchDeformation();
        }

        if (_spawningParticle != null)
        {
            if (!_spawningParticle.isStopped)
            {
                _spawningParticle.Stop();
            }

            //_spawningParticle.Play();
        }

        if (!_isCaptured)
        {
            _homeBall = null;
        }
    }