예제 #1
0
        public IEnumerator JumpMoveRight()
        {
            const float dir = 1.0f;

            Character.Player player = null;
            UInput.InputAuto input  = null;
            SetupPlayer(ref player, ref input);

            var playerTransform = player.gameObject.transform;

            // 着地するまで少し待つ
            yield return(new WaitForSeconds(0.1f));

            var startPosX = playerTransform.position.x;

            input.RequestJump(0.1f);
            yield return(new WaitForSeconds(0.1f));

            input.RequestHorizontal(dir, 0.5f);
            yield return(new WaitForSeconds(0.5f));

            var movedPosX = playerTransform.position.x;
            var diff      = movedPosX - startPosX;

            Debug.Log("start:" + startPosX + " moved:" + movedPosX + " diff:" + diff);

            const float checkDistance = 1.0f;

            Assert.AreEqual(true, (diff >= checkDistance * dir));

            yield return(null);
        }
예제 #2
0
        public IEnumerator JumpHitWallAndSlide()
        {
            Character.Player player = null;
            UInput.InputAuto input  = null;
            SetupPlayer(ref player, ref input);
            var playerTransform = player.gameObject.transform;

            // 着地するまで少し待つ
            yield return(new WaitForSeconds(0.1f));

            // 壁際までワープ
            var warpPos = playerTransform.position;

            warpPos.x = 4.0f;
            playerTransform.position = warpPos;

            var startY = playerTransform.position.y;

            input.RequestJump(0.1f);
            yield return(new WaitForSeconds(0.1f));

            input.RequestHorizontal(1.0f, 1.0f);
            yield return(new WaitForSeconds(1.0f));

            var movedY = playerTransform.position.y;

            CheckNotMove(startY, movedY);

            Assert.AreEqual(true, player.CheckAnimatorStateName("run"));

            yield return(null);
        }
예제 #3
0
 void setPlayer()
 {
     if (player == null)
     {
         this.player = base.GetComponent <Character.Player>();
     }
 }
예제 #4
0
 public bool Equals(Character.Player obj)
 {
     if (obj == null)
     {
         return(false);
     }
     return(this == obj.Outfit);
 }
예제 #5
0
 public bool Equals(Character.Player obj)
 {
     if (obj == null)
     {
         return(false);
     }
     return(this == obj.Trainer);            //Equals(obj.Trainer);
 }
예제 #6
0
        //public GameState (Player player, int? money = null, int? coin = null, byte[,] pokedex = null,
        //	TimeSpan? time = null, Vector position = new Vector(), float? direction = null, int? scene = null,
        //	int? pokecenter = null, KeyValuePair<GymBadges, DateTime?>[] gym = null, Items[] bag = null,
        //	SeriPC pc = null
        //	)
        //		: this(name: player.Name, money: money, coin: coin, trainer: player.Trainer.TrainerID,
        //				secret: player.Trainer.SecretID, gender: player.Trainer.Gender, pokedex: pokedex,
        //				time: time, position: position, direction: direction, map: scene, pokecenter: pokecenter,
        //				gym: gym, bag: bag, party: player.Trainer.Party.Serialize()
        //			)
        //{
        //}

        //public GameState (string name, Challenges? challenge = null, Feature? features = null, int? money = null, int? coin = null, int? trainer = null, int? secret = null,
        //	bool? gender = null, byte[,] pokedex = null, TimeSpan? time = null, Vector? position = null, float? direction = null, byte? follower = null,
        //	bool? creator = null, int? map = null, byte? box = null, int? pokecenter = null, KeyValuePair<GymBadges, DateTime?>[] gym = null, Items[] bag = null,
        //	SeriPokemon[] party = null, Character.PC pc = null
        //	)
        //{
        //	//BuildVersion		= SaveManager.BuildVersion;//.GetBuildVersion();
        //	TimeCreated			= DateTime.UtcNow;
        //	Challenge			= challenge		?? Challenges.Classic;
        //	Features			= features		?? new Feature();
        //
        //	PlayerName			= name;//		??                                              ;//Game.Player.Name;
        //	PlayerMoney			= money			?? 0											;//Game.Player.Money;
        //	PlayerCoins			= coin			?? 0											;//Game.Player.Coins;
        //	GymsChallenged		= gym			?? new KeyValuePair<GymBadges, DateTime?>[0]	;//Game.Player.GymsBeatTime;
        //	PlayerBag			= bag			?? new Items[0]									;//Game.Bag_Items;//Player.Bag; //playerBag;
        //	TrainerID			= trainer		?? 0											;//Game.Player.Trainer.TrainerID;
        //	SecretID			= secret		?? 0											;//Game.Player.Trainer.SecretID;
        //	IsMale				= gender		?? true											;//Game.Player.isMale;
        //	IsCreator			= creator		?? false										;//Game.Player.IsCreator;
        //	//Pokedex2			= pokedex		??                                              ;//Game.Player.Pokedex;
        //	PlayTime			= time			?? new TimeSpan()								;//Game.Player.PlayTime;
        //	PlayerPosition		= position		?? new Vector()									;//Game.PlayerPosition; //Game.Player.playerPosition;
        //	//PlayerDirection	= direction		?? 0											;//Game.PlayerDirection;//Game.Player.playerDirection;
        //	FollowerPokemon		= follower		?? 0											;//Game.Player.followerPokemon;
        //	ActiveMapId			= map			?? 0											;//Game.Area;//Game.Player.mapName;.activeScene;
        //	//ActivePcBox		= box			?? 0											;//Game.Player.ActivePcBox;
        //	//PlayerPcNames		= boxnames		?? new string[Core.STORAGEBOXES]				;//Game.Player.PC.BoxNAmes;
        //	//PlayerPcTextures	= boxtextures	?? new int[Core.STORAGEBOXES]					;//Game.Player.PC.BoxNAmes;
        //	PokeCenterId		= pokecenter	?? 0											;//(int)Game.Checkpoint;//Game.Player.Checkpoint;pkmnCenter;
        //	PlayerParty			= party			??                                              //Game.Player.Trainer.Party.Serialize();
        //		new SeriPokemon[6];//[player.Party.Length];
        //	for (int i = 0; i < PlayerParty.Length; i++)
        //	{
        //		//PlayerParty[i]= Game.Player.Trainer.Party[i];
        //		PlayerParty[i]	= new SeriPokemon();
        //	}
        //
        //	byte[,] dex2		= pokedex		?? new byte[Game.PokemonData.Where(x => x.Value.IsDefault).Count(), 3];  //Game.Player.Pokedex;
        //	Pokedex = new byte[dex2.GetLength(0)][];
        //	for (int i = 0; i < Pokedex.Length; i++)
        //	{
        //		Pokedex[i] = new byte[dex2.GetLength(1)];
        //		for (int j = 0; j < Pokedex[i].Length; j++)
        //		{
        //			Pokedex[i][j] = (byte)dex2[i, j];
        //		}
        //	}
        //
        //	PlayerPC = pc != null
        //		? new SeriPC(pc)
        //		: new SeriPC(new Monster.Pokemon[Core.STORAGEBOXES, 30], new string[Core.STORAGEBOXES], new int[Core.STORAGEBOXES], new List<Items>());
        //}

        public GameState(Character.Player player, Challenges?challenge = null, Feature?features = null,
                         string overworld = null, string daycare = null, string berry = null, string apricon = null, string npc = null
                         //, string name, int? money = null, int? coin = null, int? trainer = null, int? secret = null,
                         //bool? gender = null, byte[,] pokedex = null, TimeSpan? time = null, Vector? position = null, float? direction = null, byte? follower = null,
                         //bool? creator = null, int? map = null, byte? box = null, int? pokecenter = null, KeyValuePair<GymBadges, DateTime?>[] gym = null, Items[] bag = null,
                         //SeriPokemon[] party = null, Character.PC pc = null
                         )
        {
            //BuildVersion		= SaveManager.BuildVersion;//.GetBuildVersion();
            TimeCreated = player.StartDate;                                // != null	?  DateTimeOffset.Parse(date).UtcDateTime : DateTime.UtcNow;
            Challenge   = challenge ?? Challenges.Classic;
            Features    = features ?? new Feature();

            PlayerName      = player.Name;                       //		??                                              ;//Game.Player.Name;
            PlayerMoney     = player.Money;                      //		?? 0											;//Game.Player.Money;
            PlayerCoins     = player.Coins;                      //		?? 0											;//Game.Player.Coins;
            PlayerSavings   = player.Savings;                    //		?? 0											;
            RepelSteps      = player.RepelSteps;                 //	?? 0											;
            GymsChallenged  = player.GymsBeatTime.ToArray();     //			?? new KeyValuePair<GymBadges, DateTime?>[0]	;//Game.Player.GymsBeatTime;
            PlayerBag       = player.Bag.Contents;               //			?? new Items[0]									;//Game.Bag_Items;//Player.Bag; //playerBag;
            TrainerID       = player.Trainer.TrainerID;          //Game.Player.Trainer.TrainerID;
            SecretID        = player.Trainer.SecretID;           //Game.Player.Trainer.SecretID;
            IsMale          = player.IsMale;                     //		?? true											;//Game.Player.isMale;
            IsCreator       = player.IsCreator;                  //		?? false										;//Game.Player.IsCreator;
            PlayTime        = player.PlayTime;                   //			?? new TimeSpan()								;//Game.Player.PlayTime;
            PlayerPosition  = player.Position;                   //		?? new Vector()									;//Game.PlayerPosition; //Game.Player.playerPosition;
            PlayerDirection = player.Direction;                  //		?? Game.GameData.PlayerDirection;//Game.GameData.Player.playerDirection;
            FollowerPokemon = player.FollowPokemon;              //		?? 0											;//Game.Player.followerPokemon;
            ActiveMapId     = player.Area;                       //			?? 0											;//Game.Area;//Game.Player.mapName;.activeScene;
            //ActivePcBox		= player.box			?? 0											;//Game.Player.ActivePcBox;
            //PlayerPcNames		= player.boxnames		?? new string[Core.STORAGEBOXES]				;//Game.Player.PC.BoxNAmes;
            //PlayerPcTextures	= player.boxtextures	?? new int[Core.STORAGEBOXES]					;//Game.Player.PC.BoxNAmes;
            PokeCenterId = (int)player.Checkpoint;                       //	?? 0											;//(int)Game.Checkpoint;//Game.Player.Checkpoint;pkmnCenter;
            //PlayerOutfit		= player.Outfit;//	?? new Character.PlayerOutfit(0, 0, 0, 0, 0)
            //PlayerDayCare		= player.DayCare	?? new Character.DayCare(0);//
            PlayerParty =                                 //player.Party			??                                              //Game.Player.Trainer.Party.Serialize();
                          new SeriPokemon[player.Party.Length];
            for (int i = 0; i < PlayerParty.Length; i++)
            {
                //PlayerParty[i]= Game.Player.Trainer.Party[i];
                PlayerParty[i] = (SeriPokemon)player.Party[i];
            }

            //byte[,] dex2		= player.Pokedex;//		?? new byte[Game.PokemonData.Where(x => x.Value.IsDefault).Count(), 3];  //Game.Player.Pokedex;
            Pokedex = new byte[player.Pokedex.GetLength(0)][];
            for (int i = 0; i < Pokedex.Length; i++)
            {
                Pokedex[i] = new byte[player.Pokedex.GetLength(1)];
                for (int j = 0; j < Pokedex[i].Length; j++)
                {
                    Pokedex[i][j] = (byte)player.Pokedex[i, j];
                }
            }

            PlayerPC = player.PC != null
                                ? new SeriPC(player.PC)
                                : new SeriPC(new Monster.Pokemon[Core.STORAGEBOXES, 30], new string[Core.STORAGEBOXES], new int[Core.STORAGEBOXES], new List <Items>());
        }
예제 #7
0
 // Start is called before the first frame update
 void Start()
 {
     // 他のインスタンスの取得
     _player = GameObject.FindGameObjectWithTag("Player").GetComponent <Character.Player>();
     if (spWeaponUI == null)
     {
         spWeaponUI = FindObjectOfType <UI_SP_Weapon>();
     }
 }
예제 #8
0
        public void Setup(Character.Player currentItem, int currentIndex, CharacterPage currentCharacterPage, bool isSelected = false)
        {
            CharacterName.text = currentItem.Name;
            CoinText.text      = ((new System.Random()).Next(400)).ToString();
            SpellsText.text    = currentItem.Spells.Count.ToString();

            characterPage = currentCharacterPage;
            item          = currentItem;
            index         = currentIndex;
        }
예제 #9
0
        // Start is called before the first frame update
        void Start()
        {
            player_ = FindObjectOfType <Character.Player>();

            handGunBulletGaugeAnimator_.gameObject.SetActive(true);
            machineGunBulletGaugeAnimator_.gameObject.SetActive(false);
            shotgunBulletGaugeAnimator_.gameObject.SetActive(false);
            MissileBulletGaugeAnimator_.gameObject.SetActive(false);

            GetWeaponType();
            ChangeGaugeUI();
            SetParameter();
        }
예제 #10
0
        // Utility
        void SetupPlayer(ref Character.Player player, ref UInput.InputAuto input)
        {
            var playerObject = GameObject.Find("Player");

            Assert.IsNotNull(playerObject);

            input = playerObject.AddComponent <UInput.InputAuto>();
            Assert.IsNotNull(input);

            player = playerObject.GetComponent <Character.Player>();
            Assert.IsNotNull(player);

            player.SwapInput(input);
        }
예제 #11
0
 private void I_OnInteract(Transform who)
 {
     Character.Player P = who.GetComponent <Character.Player>();
     if (P == null)
     {
         return;
     }                 //Only the player can do dialogue.
     MM.ChangeMenu(1); //Hardcoding is not bad
     SM.WriteDialog(Dialog);
     if (ignoreafter)
     {
         gameObject.layer = 8;
     }
     if (onetime)
     {
         Destroy(this);
     }
 }
예제 #12
0
        public IEnumerator Run()
        {
            Character.Player player = null;
            UInput.InputAuto input  = null;
            SetupPlayer(ref player, ref input);

            var playerTransform = player.gameObject.transform;
            var startPosX       = playerTransform.position.x;

            input.RequestHorizontal(1.0f, 0.5f);

            yield return(new WaitForSeconds(0.5f));

            var movedPosX = playerTransform.position.x;

            Debug.Log("start:" + startPosX + " moved:" + movedPosX);
            Assert.AreEqual(true, (movedPosX >= startPosX));
            Assert.AreEqual(true, player.CheckAnimatorStateName("run"));

            yield return(null);
        }
예제 #13
0
        public static GameObject Create(Enemy spawnCharacter, Vector2 position, Character.Player player)
        {
            var objectPool = Game.instance.Stage.objectPool;
            var enemy      = objectPool.Get <Character.Enemy>(position);

            if (!enemy)
            {
                throw new NotFoundComponentException <Character.Enemy>();
            }

            enemy.Set(spawnCharacter, player, true);

            // y좌표값에 따른 정렬 처리
            var sortingGroup = enemy.GetComponent <SortingGroup>();

            if (!sortingGroup)
            {
                throw new NotFoundComponentException <SortingGroup>();
            }

            sortingGroup.sortingOrder = (int)(position.y * 10) * -1;
            return(enemy.gameObject);
        }
예제 #14
0
        public IEnumerator Jump()
        {
            Character.Player player = null;
            UInput.InputAuto input  = null;
            SetupPlayer(ref player, ref input);

            var playerTransform = player.gameObject.transform;

            // 着地するまで少し待つ
            yield return(new WaitForSeconds(0.1f));

            var startPosY = playerTransform.position.y;

            input.RequestJump(0.1f);

            // 空中に上がるまで少し待つ
            yield return(new WaitForSeconds(0.2f));

            // 飛べたか
            var movedPosY = playerTransform.position.y;

            Debug.Log("start:" + startPosY + " moved:" + movedPosY);
            Assert.AreEqual(true, (movedPosY >= startPosY));
            Assert.AreEqual(true, player.CheckAnimatorStateName("jump-up"));

            // 着地まで待つ
            yield return(new WaitForSeconds(1.0f));

            // 着地できたか
            movedPosY = playerTransform.position.y;
            CheckNotMove(startPosY, movedPosY);

            // ジャンプモーションが終了してアイドルに戻っているか
            Assert.AreEqual(true, player.CheckAnimatorStateName("idle"));

            yield return(null);
        }
예제 #15
0
        public Square getNearCharacter(Vector2 startPos, string tag)
        {
            Square startSquare = BoardSpec.getInstance().SquareFromWorldPoint(startPos);
            Square finalSquare = null;

            foreach (GameObject character in GameObject.FindGameObjectsWithTag(tag))
            {
                List <Square> openSet   = new List <Square>();
                List <Square> closedSet = new List <Square>();
                openSet.Add(startSquare);
                Character.Player player = character.gameObject.GetComponent <Character.Player>();
                if (player.status.vida <= 0)
                {
                    continue;
                }
                Square targetSquare = BoardSpec.getInstance().SquareFromWorldPoint(character.transform.position);
                if (targetSquare == null)
                {
                    continue;
                }
                while (openSet.Count > 0)
                {
                    Square currentSquare = openSet[0];
                    for (int i = 1; i < openSet.Count; i++)
                    {
                        if (openSet[i].fCost < currentSquare.fCost || openSet[i].fCost == currentSquare.fCost && openSet[i].hCost < currentSquare.hCost)
                        {
                            currentSquare = openSet[i];
                        }
                    }

                    openSet.Remove(currentSquare);
                    closedSet.Add(currentSquare);

                    if (currentSquare == targetSquare)
                    {
                        if (closedSet.Count > 1)
                        {
                            Square nearLastSquare = closedSet[closedSet.Count - 1];
                            if (finalSquare == null || nearLastSquare.fCost < finalSquare.fCost || (nearLastSquare.fCost == finalSquare.fCost && nearLastSquare.hCost < finalSquare.hCost))
                            {
                                finalSquare = nearLastSquare;
                            }
                        }
                        break;
                    }

                    foreach (Square neighbour in BoardSpec.getInstance().GetNeighbours(currentSquare))
                    {
                        if (!neighbour.canWalk(startSquare.character) && (neighbour.character == null || neighbour.character != targetSquare.character) || closedSet.Contains(neighbour))
                        {
                            continue;
                        }

                        int newMovementCostToNeighbour = currentSquare.gCost + BoardSpec.GetDistance(currentSquare, neighbour);
                        if (newMovementCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour))
                        {
                            neighbour.gCost = newMovementCostToNeighbour;
                            neighbour.hCost = BoardSpec.GetDistance(neighbour, targetSquare);

                            if (!openSet.Contains(neighbour))
                            {
                                openSet.Add(neighbour);
                            }
                        }
                    }
                }
            }
            return(finalSquare);
        }
예제 #16
0
 private static IEnumerator CoSpawnMonster(Model.Enemy enemy, Vector2 pos, Character.Player player)
 {
     EnemyFactory.Create(enemy, pos, player);
     yield return(new WaitForSeconds(UnityEngine.Random.Range(0.0f, 0.2f)));
 }