コード例 #1
0
    public void Explosion()
    {
        GameObject sludge       = Instantiate(sludgePrefab, sludgeBomb.gameObject.transform.position, Quaternion.identity); //Quaternion.identity means NO ROTATION
        Sludge     sludgeScript = sludge.GetComponent <Sludge>();

        sludgeScript.Intialize();
    }
コード例 #2
0
    public void CastRay()
    {
        Ray          ray = Camera.main.ScreenPointToRay(boss.GetComponent <BossAttack>().sludgePosition);
        RaycastHit2D hit = Physics2D.GetRayIntersection(ray, Mathf.Infinity);

        if (hit.collider != null)
        {
            GameObject sludge       = Instantiate(sludgePrefab, boss.GetComponent <BossAttack>().sludgePosition, Quaternion.identity);
            Sludge     sludgeScript = sludge.GetComponent <Sludge>();
            sludgeParticles.transform.position = hit.point;
            sludgeParticles.Play();
        }
    }
コード例 #3
0
        public static Monster CreateMonster(int level, Point location)
        {
            Pool <Monster> monsterPool = new Pool <Monster>();

            if (level <= 2)
            {
                monsterPool.Add(Rat.Create(level), 20);
                monsterPool.Add(Lichen.Create(level), 30);
                monsterPool.Add(Jackal.Create(level), 25);
                monsterPool.Add(Kobold.Create(level), 25);
            }
            else if (level <= 4)
            {
                monsterPool.Add(Lichen.Create(level), 15);
                monsterPool.Add(Rat.Create(level), 16);
                monsterPool.Add(Jackal.Create(level), 25);
                monsterPool.Add(Kobold.Create(level), 25);
                monsterPool.Add(Goblin.Create(level), 15);
                monsterPool.Add(Sludge.Create(level), 3);
                monsterPool.Add(Wolf.Create(level), 1);
            }
            else if (level <= 6)
            {
                monsterPool.Add(Jackal.Create(level), 5);
                monsterPool.Add(Wolf.Create(level), 10);
                monsterPool.Add(Kobold.Create(level), 15);
                monsterPool.Add(Goblin.Create(level), 30);
                monsterPool.Add(Sludge.Create(level), 25);
                monsterPool.Add(Gnoll.Create(level), 5);
                monsterPool.Add(Viper.Create(level), 10);
            }
            else if (level <= 8)
            {
                monsterPool.Add(Goblin.Create(level), 8);
                monsterPool.Add(Slime.Create(level), 15);
                monsterPool.Add(Viper.Create(level), 8);
                monsterPool.Add(Wolf.Create(level), 20);
                monsterPool.Add(Gnoll.Create(level), 25);
                monsterPool.Add(LizardMan.Create(level), 10);
                monsterPool.Add(Werewolf.Create(level), 4);
            }
            else if (level <= 10)
            {
                monsterPool.Add(Ogre.Create(level), 10);
                monsterPool.Add(Gnoll.Create(level), 10);
                monsterPool.Add(Werewolf.Create(level), 20);
                monsterPool.Add(LizardMan.Create(level), 30);
                monsterPool.Add(Orc.Create(level), 20);
                monsterPool.Add(Dragon.Create(level), 10);
            }
            else
            {
                monsterPool.Add(Werewolf.Create(level), 20);
                monsterPool.Add(Ogre.Create(level), 20);
                monsterPool.Add(LizardMan.Create(level), 20);
                monsterPool.Add(Orc.Create(level), 20);
                monsterPool.Add(Dragon.Create(level), 30);
            }

            Monster monster = monsterPool.Get();

            monster.X = location.X;
            monster.Y = location.Y;

            return(monster);
        }