예제 #1
0
    void OnTriggerEnter(Collider collision)
    {
        if (collision.gameObject.CompareTag("Pick Up"))
        {
            collision.gameObject.SetActive(false);
            hasShovel = true;
        }

        Flag flag = collision.gameObject.GetComponent <Flag>();

        if (flag != null)
        {
            pickUp(flag);
        }

        FlagTrigger flagTrigger = collision.gameObject.GetComponent <FlagTrigger>();

        if (flagTrigger != null)
        {
            flagTrigger.triggeredBy(this);
        }

        Snowman snowman = collision.gameObject.GetComponent <Snowman>();

        if (snowman != null)
        {
            Debug.Log("Press Action button to enter snowman");
            snowmanToEnter = snowman;
        }
    }
예제 #2
0
    void OnTriggerExit(Collider collision)
    {
        Snowman snowman = collision.gameObject.GetComponent <Snowman>();

        if (snowman != null)
        {
            Debug.Log("Left snowman, cannot enter it");
            snowmanToEnter = null;
        }
    }
예제 #3
0
        public void SnowmanNumberOfMoves_HasNotMovedYetOnEmptyBoard_ThreePossibleMoves()
        {
            var board   = new BasePiece[8, 8];
            var Snowman = new Snowman()
            {
                Color = Color.White, Location = new Vector(0, 3)
            };

            board[0, 3] = Snowman;
            var possibleMoves = Snowman.GetMoves(board).Length;

            Assert.AreEqual(5, possibleMoves);
        }
예제 #4
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         if (currentSnowman != null)
         {
             currentSnowman.Died -= HandleSnowmanDied;
         }
         currentSnowman       = Instantiate(snowman);
         currentSnowman.Died += HandleSnowmanDied;
         currentSnowman.transform.localPosition = new Vector3(Random.RandomRange(-1, 1), Random.RandomRange(-1, 1), Random.RandomRange(-1, 1));
     }
 }
예제 #5
0
    void SpawnSnowman()
    {
        //Debug.Log("Spawning snowman");
        GameObject spawnLocation = ChooseRandomSpawnLocation();
        GameObject snowman       = Instantiate(snowmanPrefab, spawnLocation.transform.position, spawnLocation.transform.rotation) as GameObject;
        Snowman    snowmanScript = snowman.GetComponent <Snowman>();

        snowmanScript.SetParent(this);
        ShootingGallerySpawn spawnScript = spawnLocation.GetComponent <ShootingGallerySpawn>();

        snowmanScript.SetScore(spawnScript.score);
        snowmanScript.StartTimer(spawnScript.time);
        totalSnowmen += 1;
        //Debug.Log(System.String.Format("Total snowmen: {0}", totalSnowmen));
    }
예제 #6
0
        public void SnowmanCanJumpOverFriendlyPieces_ReturnsTrue()
        {
            var board   = new BasePiece[8, 8];
            var Snowman = new Snowman()
            {
                Color = Color.White, Location = new Vector(0, 3)
            };

            board[0, 3] = Snowman;
            board[0, 0] = new Rook()
            {
                Color = Color.White, Location = new Vector(0, 0)
            };
            board[0, 7] = new Rook()
            {
                Color = Color.White, Location = new Vector(0, 7)
            };
            board[0, 1] = new Knight()
            {
                Color = Color.White, Location = new Vector(0, 1)
            };
            board[0, 6] = new Knight()
            {
                Color = Color.White, Location = new Vector(0, 6)
            };
            board[0, 2] = new Bishop()
            {
                Color = Color.White, Location = new Vector(0, 2)
            };
            board[0, 5] = new Bishop()
            {
                Color = Color.White, Location = new Vector(0, 5)
            };
            board[0, 4] = new King()
            {
                Color = Color.White, Location = new Vector(0, 4)
            };
            for (int i = 0; i < 8; i++)
            {
                board[1, i] = new Pawn()
                {
                    Color = Color.White, Location = new Vector(1, i)
                };
            }
            var possibleMoves = Snowman.GetMoves(board).Length;

            Assert.IsTrue(possibleMoves > 0);
        }
예제 #7
0
        public void SnowmanCannotCaptureFriendlyPieceInFrontOfIt_ReturnsTrue()
        {
            var board   = new BasePiece[8, 8];
            var Snowman = new Snowman()
            {
                Color = Color.White, Location = new Vector(0, 3)
            };
            var Pawn = new Pawn()
            {
                Color = Color.White, Location = new Vector(2, 3)
            };

            board[0, 3] = Snowman;
            board[2, 3] = Pawn;
            var possibleMoves = Snowman.GetMoves(board).Length;

            Assert.IsTrue(possibleMoves == 4);
        }
예제 #8
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Enemy")
        {
            Snowman snowman = other.GetComponentInParent <Snowman>();
            if (snowman != null)
            {
                snowman.Hit();
            }
            for (int i = 0; i < numParticles; i++)
            {
                Vector3    randomVector = new Vector3(Random.Range(-0.05f, 0.05f), Random.Range(-0.05f, 0.05f), Random.Range(-0.05f, 0.05f));
                Vector3    location     = gameObject.transform.position + (gameObject.transform.forward) + randomVector;
                GameObject bloodObject  = (GameObject)Instantiate(blood, location, gameObject.transform.rotation);
            }
        }

        Destroy(gameObject);
    }
예제 #9
0
        public static Entity Create(this EntityType entityType, World world)
        {
            Entity entity = null;

            switch (entityType)
            {
            case EntityType.None:
                return(null);

            case EntityType.Chicken:
                entity = new Chicken(world);
                break;

            case EntityType.Cow:
                entity = new Cow(world);
                break;

            case EntityType.Pig:
                entity = new Pig(world);
                break;

            case EntityType.Sheep:
                entity = new Sheep(world);
                break;

            case EntityType.Wolf:
                entity = new Wolf(world);
                break;

            case EntityType.Villager:
                entity = new Villager(world);
                break;

            case EntityType.MushroomCow:
                entity = new Mooshroom(world);
                break;

            case EntityType.Squid:
                entity = new Squid(world);
                break;

            case EntityType.Rabbit:
                entity = new Rabbit(world);
                break;

            case EntityType.Bat:
                entity = new Bat(world);
                break;

            case EntityType.IronGolem:
                entity = new VillagerGolem(world);
                break;

            case EntityType.SnowGolem:
                entity = new Snowman(world);
                break;

            case EntityType.Ocelot:
                entity = new Ocelot(world);
                break;

            case EntityType.Zombie:
                entity = new Zombie(world);
                break;

            case EntityType.Creeper:
                entity = new Creeper(world);
                break;

            case EntityType.Skeleton:
                entity = new Skeleton(world);
                break;

            case EntityType.Spider:
                entity = new Spider(world);
                break;

            case EntityType.ZombiePigman:
                entity = new ZombiePigman(world);
                break;

            case EntityType.Slime:
                entity = new Slime(world);
                break;

            case EntityType.Endermite:
                entity = new Endermite(world);
                break;

            case EntityType.Enderman:
                entity = new Enderman(world);
                break;

            case EntityType.Silverfish:
                entity = new Silverfish(world);
                break;

            case EntityType.CaveSpider:
                entity = new CaveSpider(world);
                break;

            case EntityType.Ghast:
                entity = new Ghast(world);
                break;

            case EntityType.MagmaCube:
                entity = new MagmaCube(world);
                break;

            case EntityType.Blaze:
                entity = new Blaze(world);
                break;

            case EntityType.ZombieVillager:
                entity = new ZombieVillager(world);
                break;

            case EntityType.Witch:
                entity = new Witch(world);
                break;

            case EntityType.Stray:
                entity = new Stray(world);
                break;

            case EntityType.Husk:
                entity = new Husk(world);
                break;

            case EntityType.WitherSkeleton:
                entity = new WitherSkeleton(world);
                break;

            case EntityType.Guardian:
                entity = new Guardian(world);
                break;

            case EntityType.ElderGuardian:
                entity = new ElderGuardian(world);
                break;

            case EntityType.Horse:
                entity = new Horse(world);
                break;

            case EntityType.ZombieHorse:
                entity = new ZombieHorse(world);
                break;

            case EntityType.PolarBear:
                entity = new PolarBear(world);
                break;

            case EntityType.Shulker:
                entity = new Shulker(world);
                break;

            case EntityType.EnderDragon:
                entity = new EnderDragon(world);
                break;

            case EntityType.SkeletonHorse:
                entity = new SkeletonHorse(world);
                break;

            case EntityType.Wither:
                entity = new Wither(world);
                break;

            case EntityType.Evoker:
                entity = new EvocationIllager(world);
                break;

            case EntityType.Vindicator:
                entity = new VindicationIllager(world);
                break;

            case EntityType.Vex:
                entity = new Vex(world);
                break;

            case EntityType.FallingBlock:
                entity = new EntityFallingBlock(world, null);
                break;

            case EntityType.ArmorStand:
                entity = new EntityArmorStand(world, null);
                break;

            case EntityType.Arrow:
                entity = new ArrowEntity(world, null);
                break;

            case EntityType.Item:
                entity = new ItemEntity(world, null);
                break;

            case EntityType.Mooshroom:
                entity = new Mooshroom(world);
                break;

            case EntityType.Snowball:
                entity = new SnowballEntity(world, null);
                break;

            case EntityType.ThrownEgg:
                entity = new EggEntity(world, null);
                break;

            case EntityType.Salmon:
                entity = new Salmon(world);
                break;

            case EntityType.Donkey:
                entity = new Donkey(world);
                break;

            case EntityType.Llama:
                entity = new Llama(world);
                break;

            case EntityType.Mule:
                entity = new Mule(world);
                break;

            case EntityType.Fox:
                entity = new Fox(world);
                break;

            case EntityType.Parrot:
                entity = new Parrot(world);
                break;

            case EntityType.Phantom:
                entity = new Phantom(world);
                break;

            case EntityType.Bee:
                entity = new Bee(world);
                break;

            case EntityType.LlamaSpit:
                entity = new LlamaSpit(world);
                break;

            //case EntityType.Human:
            //entity = new PlayerMob("test", world, );
            //	break;
            default:
                return(null);
            }

            return(entity);
        }
예제 #10
0
        public static Game SetUp()
        {
            var board = new BasePiece[8, 8];

            board[0, 1] = new Knight()
            {
                Color = Color.White, Location = new Vector(0, 1)
            };
            board[0, 6] = new Knight()
            {
                Color = Color.White, Location = new Vector(0, 6)
            };
            board[7, 1] = new Knight()
            {
                Color = Color.Black, Location = new Vector(7, 1)
            };
            board[7, 6] = new Knight()
            {
                Color = Color.Black, Location = new Vector(7, 6)
            };

            board[0, 2] = new Bishop()
            {
                Color = Color.White, Location = new Vector(0, 2)
            };
            board[0, 5] = new Bishop()
            {
                Color = Color.White, Location = new Vector(0, 5)
            };
            board[7, 2] = new Bishop()
            {
                Color = Color.Black, Location = new Vector(7, 2)
            };
            board[7, 5] = new Bishop()
            {
                Color = Color.Black, Location = new Vector(7, 5)
            };

            board[0, 0] = new Rook()
            {
                Color = Color.White, Location = new Vector(0, 0)
            };
            board[0, 7] = new Rook()
            {
                Color = Color.White, Location = new Vector(0, 7)
            };
            board[7, 0] = new Rook()
            {
                Color = Color.Black, Location = new Vector(7, 0)
            };
            board[7, 7] = new Rook()
            {
                Color = Color.Black, Location = new Vector(7, 7)
            };

            board[0, 4] = new King()
            {
                Color = Color.White, Location = new Vector(0, 4)
            };
            board[0, 3] = new Snowman()
            {
                Color = Color.White, Location = new Vector(0, 3)
            };
            board[7, 4] = new King()
            {
                Color = Color.Black, Location = new Vector(7, 4)
            };
            board[7, 3] = new Snowman()
            {
                Color = Color.Black, Location = new Vector(7, 3)
            };

            for (int i = 0; i < 8; i++)
            {
                board[1, i] = new Pawn()
                {
                    Color = Color.White, Location = new Vector(1, i)
                };
                board[6, i] = new Pawn()
                {
                    Color = Color.Black, Location = new Vector(6, i)
                };
            }

            Game Game = new Game();

            Game.History.Push(board);
            Game.Players.Enqueue(new BasePlayer()
            {
                Name = "player1", Color = Color.White
            });
            Game.Players.Enqueue(new BasePlayer()
            {
                Name = "player2", Color = Color.Black
            });

            return(Game);
        }
예제 #11
0
 // Use this for initialization
 void Awake()
 {
     mThisEnemy = GetComponentInParent<Enemy>();
     mSnowman = GameObject.FindGameObjectWithTag("Snowman").GetComponent<Snowman>();
 }
예제 #12
0
        public static Entity Create(this EntityType entityType, World world)
        {
            Entity entity = null;

            switch (entityType)
            {
            case EntityType.None:
                return(null);

            case EntityType.Chicken:
                entity = new Chicken(world);
                break;

            case EntityType.Cow:
                entity = new Cow(world);
                break;

            case EntityType.Pig:
                entity = new Pig(world);
                break;

            case EntityType.Sheep:
                entity = new Sheep(world);
                break;

            case EntityType.Wolf:
                entity = new Wolf(world);
                break;

            case EntityType.Villager:
                entity = new Villager(world);
                break;

            case EntityType.MushroomCow:
                entity = new Mooshroom(world);
                break;

            case EntityType.Squid:
                entity = new Squid(world);
                break;

            case EntityType.Rabbit:
                entity = new Rabbit(world);
                break;

            case EntityType.Bat:
                entity = new Bat(world);
                break;

            case EntityType.IronGolem:
                entity = new VillagerGolem(world);
                break;

            case EntityType.SnowGolem:
                entity = new Snowman(world);
                break;

            case EntityType.Ocelot:
                entity = new Ocelot(world);
                break;

            case EntityType.Zombie:
                entity = new Zombie(world);
                break;

            case EntityType.Creeper:
                entity = new Creeper(world);
                break;

            case EntityType.Skeleton:
                entity = new Skeleton(world);
                break;

            case EntityType.Spider:
                entity = new Spider(world);
                break;

            case EntityType.ZombiePigman:
                entity = new ZombiePigman(world);
                break;

            case EntityType.Slime:
                entity = new Slime(world);
                break;

            case EntityType.Enderman:
                entity = new Enderman(world);
                break;

            case EntityType.Silverfish:
                entity = new Silverfish(world);
                break;

            case EntityType.CaveSpider:
                entity = new CaveSpider(world);
                break;

            case EntityType.Ghast:
                entity = new Ghast(world);
                break;

            case EntityType.MagmaCube:
                entity = new MagmaCube(world);
                break;

            case EntityType.Blaze:
                entity = new Blaze(world);
                break;

            case EntityType.ZombieVillager:
                entity = new ZombieVillager(world);
                break;

            case EntityType.Witch:
                entity = new Witch(world);
                break;

            case EntityType.Stray:
                entity = new Stray(world);
                break;

            case EntityType.Husk:
                entity = new Husk(world);
                break;

            case EntityType.WitherSkeleton:
                entity = new WitherSkeleton(world);
                break;

            case EntityType.Guardian:
                entity = new Guardian(world);
                break;

            case EntityType.ElderGuardian:
                entity = new ElderGuardian(world);
                break;

            case EntityType.Horse:
                entity = new Horse(world);
                break;

            case EntityType.PolarBear:
                entity = new PolarBear(world);
                break;

            case EntityType.Shulker:
                entity = new Shulker(world);
                break;

            case EntityType.EnderDragon:
                entity = new EnderDragon(world);
                break;

            case EntityType.SkeletonHorse:
                entity = new SkeletonHorse(world);
                break;

            case EntityType.Wither:
                entity = new Wither(world);
                break;

            case EntityType.Evoker:
                entity = new EvocationIllager(world);
                break;

            case EntityType.Vindicator:
                entity = new VindicationIllager(world);
                break;

            case EntityType.Vex:
                entity = new Vex(world);
                break;

            //case EntityType.Human:
            //entity = new PlayerMob("test", world, );
            //	break;
            default:
                return(null);
            }

            return(entity);
        }
예제 #13
0
 void RpcEnterSnowman()
 {
     snowmanToEnter = null;
     disable();
 }
예제 #14
0
    static void Main(string[] args)
    {
        int[] sequence = Console.ReadLine()
                         .Split()
                         .Select(int.Parse)
                         .ToArray();

        List <Snowman> snowmen = new List <Snowman>();

        for (int index = 0; index < sequence.Length; index++)
        {
            Snowman snowman = new Snowman
            {
                Attack = sequence[index],
                Dead   = false
            };

            snowmen.Add(snowman);
        }

        while (snowmen.Count > 1)
        {
            for (int index = 0; index < snowmen.Count; index++)
            {
                if (snowmen[index].Dead == false)
                {
                    int attacker = index;
                    int defender = snowmen[index].Attack % snowmen.Count;
                    int killed   = Math.Abs(defender - attacker);

                    if (killed == 0)
                    {
                        Console.WriteLine($"{attacker} performed harakiri");
                        snowmen[attacker].Dead = true;
                    }
                    else if (killed % 2 == 0)
                    {
                        Console.WriteLine($"{attacker} x {defender} -> {attacker} wins");
                        snowmen[defender].Dead = true;
                    }
                    else
                    {
                        Console.WriteLine($"{attacker} x {defender} -> {defender} wins");
                        snowmen[attacker].Dead = true;
                    }

                    if (MoreThanOne(snowmen) == false)
                    {
                        break;
                    }
                }
            }

            for (int index = snowmen.Count - 1; index >= 0; index--)
            {
                if (snowmen[index].Dead == true)
                {
                    snowmen.RemoveAt(index);
                }
            }
        }
    }
예제 #15
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            BankBox box = from.BankBox;

            if (box == null)
            {
                return(false);
            }

            if (dropped is HolidayDeed)
            {
                if (message != null)
                {
                    SayTo(from, message);
                }
                Item random     = null;
                int  randomitem = Utility.RandomMinMax(0, 3);

                if (randomitem == 0)
                {
                    random      = new Snowman();
                    random.Name = "snowman";
                }

                if (randomitem == 1)
                {
                    random = new SnowPile();
                }

                if (randomitem == 2)
                {
                    random = new EternalEmbers();
                }

                if (randomitem == 3)
                {
                    if (Utility.RandomBool())
                    {
                        random = new RedPoinsettia();
                    }
                    else
                    {
                        random = new WhitePoinsettia();
                    }

                    random.Name = "poinsettia";
                }

                Item roast = new RoastPig();
                roast.Name = "roast pig";

                Item candle = new CandleLong();
                candle.Name = "candle";
                candle.Hue  = Utility.RandomList(0, 3343, 72, 7, 1274, 53);

                Item cookie = new Cookies();
                cookie.Name = "Christmas cookies";

                GiftBox Giftbox = new GiftBox();

                string year      = DateTime.Now.Year.ToString();
                string Signature = "Christmas " + year;

                Giftbox.Name = Signature;

                roast.Name += " - " + Signature;
                Giftbox.DropItem(roast);
                candle.Name += " - " + Signature;
                Giftbox.DropItem(candle);
                random.Name += " - " + Signature;
                Giftbox.DropItem(random);
                cookie.Name += " - " + Signature;
                Giftbox.DropItem(cookie);

                //drop it all to bank
                // Adam: This method fails if the bank is full!
                // box.TryDropItem( from, Giftbox, false );
                // this one won't
                box.AddItem(Giftbox);

                //delete deed.
                dropped.Delete();
                return(true);
            }
            else             //if not a holiday deed dont accept anything
            {
                return(false);
            }
        }
예제 #16
0
        static void Main(string[] args)
        {
            int[]          snowmen     = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            List <Snowman> snowmenList = new List <Snowman>();

            for (int i = 0; i < snowmen.Length; i++)
            {
                Snowman snowman = new Snowman();
                snowman.AttackerIndex = i;

                if (snowmen[i] > snowmen.Length)
                {
                    snowman.TargetIndex = snowmen[i] % snowmen.Length;
                }
                else
                {
                    snowman.TargetIndex = snowmen[i];
                }

                snowman.Lost    = false;
                snowman.Suicide = false;
                snowmenList.Add(snowman);
            }
            while (snowmenList.Count > 1)
            {
                foreach (var s in snowmenList)
                {
                    if (s.Lost == false && s.Suicide == false)
                    {
                        if (s.TargetIndex > snowmenList.Count)
                        {
                            s.TargetIndex = s.TargetIndex % snowmenList.Count;
                        }

                        int diff = Math.Abs(s.AttackerIndex - s.TargetIndex);

                        if (s.AttackerIndex == s.TargetIndex)
                        {
                            s.Suicide = true;
                            Console.WriteLine($"{s.AttackerIndex} performed harakiri");
                        }
                        else if (diff % 2 == 0)
                        {
                            s.Lost = false;
                            snowmenList[s.TargetIndex].Lost = true;
                            Console.WriteLine($"{s.AttackerIndex} x {s.TargetIndex} -> {s.AttackerIndex} wins");
                        }
                        else
                        {
                            s.Lost = true;
                            Console.WriteLine($"{s.AttackerIndex} x {s.TargetIndex} -> {s.TargetIndex} wins");
                        }
                    }
                }

                for (int i = 0; i < snowmenList.Count; i++)
                {
                    if (snowmenList[i].Lost == true || snowmenList[i].Suicide == true)
                    {
                        snowmenList.Remove(snowmenList[i]);
                        i--;
                    }
                }
            }
        }