Esempio n. 1
0
    }     //end f'n void SpawnEnemiesAtPosition(Vector3, GameObject, int)

    /**A function to spawn the given enemy [prefab] at the given position; if there are more */
    public void SpawnEnemiesAtPosition(Spawner enemy_spawner, Vector3 position, EnemyName enemy_name, int number_of_enemies)
    {
//		Debug.Log ("Do we make it this far, at least? Enemy name: " + enemy_name.ToString());
        if (this.m_EnemyContainer == null)
        {
            this.m_EnemyContainer      = new GameObject();
            this.m_EnemyContainer.name = enemy_name.ToString() + "Container";
        }
        //For consistency, though the empty's position really doesn't matter.
        this.m_EnemyContainer.transform.position = position;
        //for however many enemies are needed...
        for (int index = 0; index < number_of_enemies; index++)
        {
            //Spawn the enemy
//			GameObject enemy_obj = GameObject.Instantiate(prefab, this.m_EnemyContainer.transform);
            GameObject enemy_obj = enemy_spawner.SpawnEnemy(enemy_name, this.m_EnemyContainer.transform);
            //Position the enemy
            enemy_obj.transform.position = position;
            //			this.m_EnemyContainer.transform.enemy_obj
            //Adjust position with respect to number of enemies
            //?

            //Then extract the Enemy component and store it in the target list, to be checked later
            DefaultEnemy enemy = enemy_obj.GetComponent <DefaultEnemy>();
            //if the enemy component isn't in the object, it's in one of the children
            if (enemy == null)
            {
                enemy           = enemy_obj.GetComponentInChildren <DefaultEnemy> ();
                enemy.m_Spawner = this.m_EnemyLootSpawner;
            }

            this.m_Targets.Add(enemy);
        } //end for
    }     //end f'n void SpawnEnemiesAtPosition(Spawner, Vector3, EnemyName, int)
Esempio n. 2
0
 public override int GetHashCode()
 {
     return(MyRobotName.GetHashCode()
            ^ EnemyName.GetHashCode()
            ^ BattleType.GetHashCode()
            );
 }
    /// <summary>
    /// Builds a new BattleEnemy: name, stats, hp/mpMax.
    /// Other properties are set later with a call of LoadObjs.
    /// </summary>
    /// <param name="name">Name as EnemyName</param>
    /// <param name="stats">BattleStats is created outside this class and passed in</param>
    public BattleEnemy(EnemyName name, BattleStats stats)
    {
        enemyName = name;

        this.Stats = stats;

        hp = stats.HPMax;
        mp = stats.MPMax;
    }
    // Called by Enemy_Dungeon when a collision occurs
    public static void LoadBattle(EnemyName party)
    {
        AudioManager.PlaySound(AudioClipName.Encounter);
        BattleEarnings = 0;
        battleParty    = party;
        LoadBattleMusic(party);

        // Open battle scene
        MenuManager.GoToMenu(MenuName.Battle);
    }
Esempio n. 5
0
    /// <summary>
    /// Creates a new BattleEnemy and gives it its data
    /// </summary>
    /// <param name="name">Name as EnemyName</param>
    /// <returns></returns>
    public static BattleEnemy MakeNewBattleEnemy(EnemyName name)
    {
        // Create data
        BattleEnemy orig = Data[name];
        // Create enemy using data
        BattleEnemy newEnemy = new BattleEnemy(name, orig.Stats);

        newEnemy.HealAll();
        return(newEnemy);
    }
Esempio n. 6
0
        public VirtualEnemy(Battle battle, Renderer renderer, Sound sound, Player.Player player, Vector3 position, EnemyName enemyName)
            : base(battle, renderer, sound)
        {
            this.player    = player;
            this.position  = position;
            this.enemyName = enemyName;
            //Coordinate();

            state   = State.NORMAL;
            haigage = 100f;
        }
Esempio n. 7
0
        public static T GetPrefab <T>(EnemyName name)
        {
            //See if Exists
            if (!m_PrefabList.ContainsKey(name))
            {
                return(default(T));
            }

            var data = m_PrefabList[name];
            T   obj  = (T)Activator.CreateInstance(typeof(T), data.Model, data.Body, data.TextureData);

            return(obj);
        }
Esempio n. 8
0
        public EnemyPrefab(RenderContext context, EnemyName name, string assetFile)
        {
            Name = name;

            if (m_Model == null)
            {
                if (!File.Exists("Content/Model/m_" + assetFile + ".xnb"))
                {
                    m_Model = context.Content.Load <Model>("Model/Default");
                    Console.WriteLine("Failed to load model " + assetFile);
                }
                else
                {
                    m_Model = context.Content.Load <Model>("Model/m_" + assetFile);
                }
            }
            if (m_Body == null)
            {
                if (assetFile == "EnemyRotator")
                {
                    m_Body          = BodyFactory.CreateRectangle(context.World, 250, 550, 1);
                    m_Body.BodyType = BodyType.Static;
                    m_Body.Enabled  = false;
                    m_Body.IsSensor = true; //pickups are always triggers
                }
                else if (assetFile == "SmashingWall")
                {
                    m_Body          = BodyFactory.CreateRectangle(context.World, 75, 250, 1);
                    m_Body.BodyType = BodyType.Static;
                    m_Body.Enabled  = false;
                    //m_Body.IsSensor = true; //pickups are always triggers
                }
                else
                {
                    m_Body          = BodyFactory.CreateRectangle(context.World, 100, 100, 1);
                    m_Body.BodyType = BodyType.Dynamic;
                    m_Body.Enabled  = false;
                }
            }

            if (!File.Exists("Content/Textures/Models/D_" + assetFile + ".xnb"))
            {
                Console.WriteLine("EnemyPrefab:: Missing Texture for " + assetFile);
                return;
            }

            TextureData.Diffuse = context.Content.Load <Texture2D>("Textures/Models/D_" + assetFile);
        }
Esempio n. 9
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.Unicode;

            string    userInput = string.Empty;
            EnemyName enemyName = EnemyName.Gabriel;

            while (string.IsNullOrWhiteSpace(userInput))
            {
                Console.WriteLine("請輸入要捉取的天司代號:");
                Console.WriteLine("1:ミカエル、2:ガブリエル、3:ウリエル、4:ラファエル");
                userInput = Console.ReadLine();

                if (false == Enum.TryParse(userInput, out enemyName))
                {
                    Console.WriteLine("輸入錯誤,請重新輸入");
                    userInput = string.Empty;
                }
            }


            //3s一次
            //int interval = 3000;
            TimeSpan interval = TimeSpan.FromMilliseconds(3000);

            WriteLog("準備開始偵測...");
            //Timer timer = new Timer(FindMatch, replaceDayString, 2000, interval);
            //FindMatch(replaceDayString);

            DateTime timeLastCall = DateTime.Now;

            //因為clipboard只能run在STA, 只好自已寫TIMER

            while (true)
            {
                DateTime timeNow = DateTime.Now;
                if (timeNow - timeLastCall > interval)
                {
                    FindMatch(enemyName);
                    timeLastCall = timeNow;
                    Thread.Sleep(500);
                }
            }
            ////Console.WriteLine(content);
            //Console.ReadLine();
        }
    // Choose the appropriate music to play
    static void LoadBattleMusic(EnemyName party)
    {
        // special cases
        if (dungeonLevel == 6)
        {
            // no music change on battle load in phantom forest
        }
        else if (dungeonLevel == 3) // only change in 3 if tunnelarmor
        {
            // no change if regular enemy, but do change for the boss
            if (party == EnemyName.Tunnel_Armor)
            {
                AudioManager.PlayMusic(AudioClipName.Music_The_Unforgiven);
            }
        }
        else
        // most cases
        {
            switch (party)
            {
            case EnemyName.Ultros:
                AudioManager.PlayMusic(AudioClipName.Music_The_Decisive_Battle);
                break;

            case EnemyName.Whelk:
                AudioManager.PlayMusic(AudioClipName.Music_The_Decisive_Battle);
                break;

            case EnemyName.Vargas:
                AudioManager.PlayMusic(AudioClipName.Music_Wild_West);
                break;

            case EnemyName.Chupon:
                AudioManager.PlayMusic(AudioClipName.Music_The_Wedding_Waltz_Duel_4);
                break;

            case EnemyName.Atma_Weapon:
                AudioManager.PlayMusic(AudioClipName.Music_The_Fierce_Battle);
                break;

            default:
                AudioManager.PlayMusic(AudioClipName.Music_Battle_Theme);
                break;
            }
        }
    }
Esempio n. 11
0
        public Dragon(Battle battle, Renderer renderer, Sound sound, Player.Player player, Vector3 position, EnemyName enemyName)
            : base(battle, renderer, sound, player, position, enemyName)
        {
            hp             = 1f; //HP兼攻撃ゲージ
            basePosition   = position;
            this.position  = basePosition;
            this.enemyName = enemyName;
            StateSet(State.NORMAL);

            physics = new MovePhysics(0.015f, null, null);
            effect.Parameters["Value"].SetValue(1f);
            effect.Parameters["Red"].SetValue(1f);
        }
Esempio n. 12
0
        private static void FindMatch(EnemyName enemyName)
        {
            string url =
                "http://gbf-wiki.com/index.php?%BB%CD%C2%E7%C5%B7%BB%CA%A5%DE%A5%EB%A5%C1%A5%D0%A5%C8%A5%EB_%B5%DF%B1%E7%CA%E7%BD%B8%C8%C4";

            WriteLog("偵測中");
            string content;

            using (var client = new WebClient())
            {
                client.Encoding = Encoding.GetEncoding("EUC-JP");
                content         = client.DownloadString(url);
            }

            //最後一行li沒有換行
            var   listExpress = "(?<list>(<li class=\"pcmt\">.*</li>))";
            Regex regex       = new Regex(listExpress);
            //li用
            var liExpress = "<input.*>.*(?<matchid>([a-zA-Z0-9]){8}).*.*--.*<span class=\"comment_date\">(?<date>.*)<span";
            var liRegex   = new Regex(liExpress);

            var matches = regex.Matches(content);

            foreach (Match match in matches)
            {
                var listGroup = match.Groups["list"];
                foreach (Capture capture in listGroup.Captures)
                {
                    if (capture.Value.Contains(enemyName.GetDescription()))
                    {
                        foreach (Match liMatch in liRegex.Matches(capture.Value))
                        {
                            //把曜日處理掉
                            var   matchDtString = liMatch.Groups["date"].Value;
                            Regex regDay        = new Regex(@"\(\w\)");
                            matchDtString = regDay.Replace(matchDtString, string.Empty);
                            var matchId = liMatch.Groups["matchid"].Value;

                            DateTime matchDt = DateTime.MinValue;
                            if (!string.IsNullOrWhiteSpace(matchId))
                            {
                                if (DateTime.TryParse(matchDtString, out matchDt))
                                {
                                    if (matchDt.CompareTo(_lastMatchTime) > 0)
                                    {
                                        WriteLog($"發現{enemyName.GetDescription()},ID:{matchId}");
                                        Clipboard.SetText(matchId);
                                        PlaySound();
                                        _lastMatchTime = matchDt;
                                    }
                                }
                                else
                                {
                                    WriteLog("日期轉換錯誤。 " + matchDtString);
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 13
0
    /// <summary>
    /// Reads configuration data from a file. If the file read fails, the constructor contains
    /// default values for each kind of configuration data
    /// REFACTOR: Break this into three different constructors
    /// </summary>
    public ConfigData(ConfigDataType type)
    {
        // Read and save configuration data from file
        StreamReader input = null;

        // Three kinds of ConfigData
        switch (type)
        {
        case ConfigDataType.EnemyData:
            #region EnemyData

            try
            {
                // Create stream reader input
                input = File.OpenText(Path.Combine(
                                          Application.streamingAssetsPath, EnemyDataFileName));

                // Populate StatNames from header row
                string            currentLine = input.ReadLine();
                string[]          names       = currentLine.Split(',');
                BattleStatNames[] statHeader  = new BattleStatNames[names.Length];

                // Validate the header row before importing
                BattleStats validate = new BattleStats();

                for (int i = 1; i < names.Length; i++)
                {
                    statHeader[i] = (BattleStatNames)Enum.Parse(typeof(BattleStatNames), names[i]);
                    if (!validate.ValidateOrder(i - 1, statHeader[i]))
                    {
                        errorMessage = "Headers do not match BattleStats.\nUsing default settings.";
                        Debug.Log(errorMessage);
                        SetEnemyStatDataDefaultValues();
                        break;
                    }
                }

                // Only procede forward if there is no error with the headers
                if (errorMessage == null)
                {
                    // Populate values for enemyData
                    currentLine = input.ReadLine();
                    while (currentLine != null)
                    {
                        // Parse current line into name and stat values
                        string[]  tokens    = currentLine.Split(',');
                        EnemyName enemyName =
                            (EnemyName)Enum.Parse(
                                typeof(EnemyName), tokens[0]);

                        int[] intTokens = new int[tokens.Length - 1];

                        for (int i = 0; i < tokens.Length - 1; i++)
                        {
                            int bStat;
                            intTokens[i] = int.TryParse(tokens[i + 1], out bStat) ? bStat : 0;
                        }

                        // import the array of ints into a new BattleStats
                        BattleStats battleStats = new BattleStats();
                        battleStats.Import(intTokens);

                        // add to enemyStatData
                        enemyStatData.Add(enemyName, battleStats);

                        // queue next line in csv
                        currentLine = input.ReadLine();
                    }
                }
            }
            catch (Exception e)
            {
                // send the error to the console for debugging
                Debug.Log(e);
                errorMessage = "Problem loading file. \nUsing default settings.\n";
                Debug.Log(errorMessage);

                SetEnemyStatDataDefaultValues();
            }
            finally
            {
                // close files that were opened
                if (input != null)
                {
                    input.Close();
                }
            }

            break;     // end of EnemyData
            #endregion EnemyData

        case ConfigDataType.InvData:
            #region InvData

            try
            {
                // create stream reader input
                input = File.OpenText(Path.Combine(
                                          Application.streamingAssetsPath, InvDataFileName));

                // populate StatNames from header row
                string            currentLine = input.ReadLine();
                string[]          headings    = currentLine.Split(',');
                BattleStatNames[] statHeader  = new BattleStatNames[headings.Length];

                // Validate the header row before importing
                // 0 name, 1 fullname, 2 description, 3 id, 4 price, 5 type, 6 subtype, 7 slot,
                // 8 rank, 9+ Battlestats
                BattleStats validate = new BattleStats();

                for (int i = 9; i < headings.Length; i++)
                {
                    statHeader[i] = (BattleStatNames)Enum.Parse(typeof(BattleStatNames), headings[i]);
                    if (!validate.ValidateOrder(i - 9, statHeader[i]))
                    {
                        errorMessage = "Headers do not match BattleStats.\nUsing default settings.";
                        Debug.Log(errorMessage);
                        SetInvDataDefaultValues();
                        break;
                    }
                }

                // only procede forward if there is no error with the headers
                if (errorMessage == null)
                {
                    // populate values for enemyData
                    currentLine = input.ReadLine();
                    while (currentLine != null)
                    {
                        // parse current line into name and stat values
                        // 0 name, 1 fullname, 2 description, 3 id, 4 price, 5 type, 6 subtype, 7 slot, 8 rank

                        // 0 name
                        string[] tokens  = currentLine.Split(',');
                        InvNames invName =
                            (InvNames)Enum.Parse(
                                typeof(InvNames), tokens[0]);

                        // 1 fullname
                        string fullName = tokens[1];

                        // 2 description
                        string description = tokens[2];

                        // 3 id
                        int id = int.Parse(tokens[3]);

                        // 4 price
                        int price = int.Parse(tokens[4]);

                        // 5 type
                        InvType invType = (InvType)Enum.Parse(
                            typeof(InvType), tokens[5]);

                        // 6 subtype
                        InvSubtype invSubtype = (InvSubtype)Enum.Parse(
                            typeof(InvSubtype), tokens[6]);

                        Sprite sprite = Resources.Load <Sprite>(@"Sprites\InvItems\"
                                                                + invType.ToString() + @"\"
                                                                + invSubtype.ToString() + @"\"
                                                                + invName.ToString());

                        // 7 slot
                        EquipSlots slot = (EquipSlots)Enum.Parse(
                            typeof(EquipSlots), tokens[7]);

                        // 8 rank
                        int rank = int.Parse(tokens[8]);


                        // BattleStats is only included for InvEqItems (equipment and tomes)
                        // This is an InvEqItem
                        if (invType == InvType.Tome || invType == InvType.Weapon || invType == InvType.Armor)
                        {
                            // 9+ BattleStats

                            int[] intTokens = new int[tokens.Length - 9];

                            for (int i = 0; i < tokens.Length - 9; i++)
                            {
                                int bStat;
                                intTokens[i] = int.TryParse(tokens[i + 9], out bStat) ? bStat : 0;
                            }

                            // import the array of ints into a new BattleStats
                            BattleStats battleStats = new BattleStats();
                            battleStats.Import(intTokens);

                            // create a new InvEqItem
                            InvEqItem item = new InvEqItem(invName, fullName, description, sprite,
                                                           id, price, 0, invType, invSubtype, slot, rank, battleStats);

                            // add to invStatData
                            invStatData.Add(invName, item);
                        }
                        // else it is a potion, so add a regular InvItem
                        else
                        {
                            // create a new InvEqItem
                            InvItem item = new InvItem(invName, fullName, description, sprite,
                                                       id, price, 0, invType, invSubtype, slot, rank);

                            // add to invStatData
                            invStatData.Add(invName, item);
                        }

                        // queue next line in csv
                        currentLine = input.ReadLine();
                    }
                }
            }
            catch (Exception e)
            {
                // send the error to the console for debugging
                Debug.Log(e);
                errorMessage = "Problem loading file. \nUsing default settings.\n";
                Debug.Log(errorMessage);

                SetInvDataDefaultValues();
            }
            finally
            {
                // close files that were opened
                if (input != null)
                {
                    input.Close();
                }
            }

            break;
            #endregion InvData

        case ConfigDataType.AbilityData:
            #region AbilityData
            try
            {
                // create stream reader input
                input = File.OpenText(Path.Combine(
                                          Application.streamingAssetsPath, AbilityDataFileName));

                // populate StatNames from header row
                string   currentLine = input.ReadLine();
                string[] headings    = currentLine.Split(',');

                // ignoring the header row

                // populate values for abilityData
                currentLine = input.ReadLine();
                while (currentLine != null)
                {
                    // parse current line into name and stat values
                    // 0 name, 1 isPhysical, 2 mp, 3 noReduction, 4 modifier,
                    // 5 noMiss, 6 hitOverride, 7 noCrit

                    // 0 name
                    string[]   tokens = currentLine.Split(',');
                    BattleMode name   =
                        (BattleMode)Enum.Parse(
                            typeof(BattleMode), tokens[0]);

                    // 1 isPhyical
                    bool isPhysical = bool.Parse(tokens[1].ToLower());

                    // 2 mp
                    int?mp = null;
                    if (int.TryParse(tokens[2], out int num))
                    {
                        mp = num;
                    }
                    else
                    {
                        mp = null;
                    }

                    // 3 noReduction
                    bool noReduction = bool.Parse(tokens[3].ToLower());

                    // 4 modifier
                    float modifier = float.Parse(tokens[4]);

                    // 5 noMiss
                    bool noMiss = bool.Parse(tokens[5].ToLower());

                    // 6 hitOverride
                    int?hitOverride = null;
                    if (int.TryParse(tokens[6], out int num2))
                    {
                        hitOverride = num2;
                    }
                    else
                    {
                        hitOverride = null;
                    }

                    // 7 noCrit
                    bool noCrit = bool.Parse(tokens[7].ToLower());


                    // create a new battleAbility
                    BattleAbility ability = new BattleAbility(name, isPhysical, mp, noReduction, modifier, noMiss, hitOverride, noCrit);

                    // add to invStatData
                    abilityStatData.Add(name, ability);

                    // queue next line in csv
                    currentLine = input.ReadLine();
                }
            }
            catch (Exception e)
            {
                // send the error to the console for debugging
                Debug.Log(e);
                errorMessage = "Problem loading file. \nUsing default settings.\n";
                Debug.Log(errorMessage);

                SetAbilityDataDefaultValues();
            }
            finally
            {
                // close files that were opened
                if (input != null)
                {
                    input.Close();
                }
            }

            break;
            #endregion AbilityData

        default:
            break;
        }
    }
Esempio n. 14
0
    public EnemyParty(EnemyName party)
    {
        // Recyclable array of positions for a single KIND of enemy
        Vector2[] positions;

        // Based on the enemy encountered in the dungeon, form an EnemyParty
        switch (party)
        {
        case EnemyName.none:
            // this should not occur, but if it does, one wererat
            positions    = new Vector2[1];
            positions[0] = new Vector2(2.62f, 0.49f);
            placements.Add(EnemyName.Wererat, positions);
            break;

        case EnemyName.Wererat:
            // three wererats
            positions    = new Vector2[3];
            positions[0] = new Vector2(2.62f, 0.49f);
            positions[1] = new Vector2(3.39f, 2.73f);
            positions[2] = new Vector2(5.36f, 1.06f);
            placements.Add(EnemyName.Wererat, positions);
            break;

        case EnemyName.Ultros:
            // boss battle
            // two wererats and one ultros
            positions    = new Vector2[2];
            positions[0] = new Vector2(1.94f, 0.71f);
            positions[1] = new Vector2(2.24f, 2.35f);
            placements.Add(EnemyName.Wererat, positions);

            positions    = new Vector2[1];
            positions[0] = new Vector2(5.44f, 1.50f);
            placements.Add(EnemyName.Ultros, positions);

            isBoss = true;
            bossID = EnemyName.Ultros;
            break;

        case EnemyName.Wolf:
            // two wolves, two guards
            positions    = new Vector2[2];
            positions[0] = new Vector2(2.9f, 0.4f);
            positions[1] = new Vector2(3.7f, 2.4f);
            placements.Add(EnemyName.Wolf, positions);

            positions    = new Vector2[2];
            positions[0] = new Vector2(5.3f, 0.4f);
            positions[1] = new Vector2(6.1f, 2.4f);
            placements.Add(EnemyName.Guard, positions);
            break;

        case EnemyName.Whelk:
            // one whelk
            positions    = new Vector2[1];
            positions[0] = new Vector2(4.8f, 1.80f);
            placements.Add(EnemyName.Whelk, positions);

            isBoss = true;
            bossID = EnemyName.Whelk;
            break;

        case EnemyName.Mechanic:
            // four mechanics
            positions    = new Vector2[4];
            positions[0] = new Vector2(1.5f, 1.50f);
            positions[1] = new Vector2(3.3f, 1.50f);
            positions[2] = new Vector2(5.1f, 1.50f);
            positions[3] = new Vector2(6.9f, 1.50f);
            placements.Add(EnemyName.Mechanic, positions);
            break;

        case EnemyName.Grease_Monkey:
            // three grease monkeys, three mechanics
            positions    = new Vector2[3];
            positions[0] = new Vector2(2.3f, 0.8f);
            positions[1] = new Vector2(4.3f, 3.1f);
            positions[2] = new Vector2(6.3f, 0.8f);
            placements.Add(EnemyName.Mechanic, positions);

            positions    = new Vector2[3];
            positions[0] = new Vector2(2.3f, 2.4f);
            positions[1] = new Vector2(4.3f, 0.1f);
            positions[2] = new Vector2(6.3f, 2.4f);
            placements.Add(EnemyName.Grease_Monkey, positions);
            break;

        case EnemyName.Roper:
            // three ropers
            positions    = new Vector2[3];
            positions[0] = new Vector2(2.6f, 0.2f);
            positions[1] = new Vector2(4.1f, 2.7f);
            positions[2] = new Vector2(6.4f, 0.6f);
            placements.Add(EnemyName.Roper, positions);
            break;

        case EnemyName.Magitek_Armor:
            // two magitek
            positions    = new Vector2[2];
            positions[0] = new Vector2(1.7f, 2.1f);
            positions[1] = new Vector2(5.4f, 1.2f);
            placements.Add(EnemyName.Magitek_Armor, positions);
            break;

        case EnemyName.Tunnel_Armor:
            // two magitek
            positions    = new Vector2[1];
            positions[0] = new Vector2(3.85f, 1.6f);
            placements.Add(EnemyName.Tunnel_Armor, positions);

            isBoss = true;
            bossID = EnemyName.Tunnel_Armor;
            break;

        case EnemyName.Cirpius:
            // three Cirpius
            positions    = new Vector2[3];
            positions[0] = new Vector2(1.8f, 2.2f);
            positions[1] = new Vector2(4.0f, 1.4f);
            positions[2] = new Vector2(6.0f, 2.8f);
            placements.Add(EnemyName.Cirpius, positions);
            break;

        case EnemyName.Brawler:
            // two Brawlers, two Cirpius
            positions    = new Vector2[2];
            positions[0] = new Vector2(2.0f, 1.2f);
            positions[1] = new Vector2(4.8f, 0.4f);
            placements.Add(EnemyName.Brawler, positions);

            positions    = new Vector2[2];
            positions[0] = new Vector2(3.4f, 3.2f);
            positions[1] = new Vector2(6.1f, 2.4f);
            placements.Add(EnemyName.Cirpius, positions);
            break;

        case EnemyName.Tusker:
            // two tuskers, two brawlers
            positions    = new Vector2[2];
            positions[0] = new Vector2(2.6f, 0.7f);
            positions[1] = new Vector2(2.2f, 2.6f);
            placements.Add(EnemyName.Tusker, positions);

            positions    = new Vector2[2];
            positions[0] = new Vector2(5.4f, 0.7f);
            positions[1] = new Vector2(5.0f, 2.6f);
            placements.Add(EnemyName.Brawler, positions);
            break;

        case EnemyName.Vargas:
            // two brawlers, one Vargas
            positions    = new Vector2[2];
            positions[0] = new Vector2(0.8f, 1.6f);
            positions[1] = new Vector2(2.8f, 0.8f);
            placements.Add(EnemyName.Brawler, positions);

            positions    = new Vector2[1];
            positions[0] = new Vector2(5.0f, 1.7f);
            placements.Add(EnemyName.Vargas, positions);

            isBoss = true;
            bossID = EnemyName.Vargas;
            break;

        case EnemyName.Bomb:
            // five bombs
            positions    = new Vector2[5];
            positions[0] = new Vector2(2.2f, 1.8f);
            positions[1] = new Vector2(3.8f, 0.2f);
            positions[2] = new Vector2(3.4f, 3.3f);
            positions[3] = new Vector2(5.8f, 3.1f);
            positions[4] = new Vector2(6.1f, 1.0f);
            placements.Add(EnemyName.Bomb, positions);
            break;

        case EnemyName.Sky_Armor:
            // three sky armor
            positions    = new Vector2[3];
            positions[0] = new Vector2(2.7f, 1.6f);
            positions[1] = new Vector2(5.0f, 3.1f);
            positions[2] = new Vector2(6.6f, 0.9f);
            placements.Add(EnemyName.Sky_Armor, positions);
            break;

        case EnemyName.Spit_Fire:
            // one skyarmor, three bombs, one spitfire
            positions    = new Vector2[1];
            positions[0] = new Vector2(1.9f, 0.7f);
            placements.Add(EnemyName.Sky_Armor, positions);

            positions    = new Vector2[3];
            positions[0] = new Vector2(3.2f, 3.4f);
            positions[1] = new Vector2(4.2f, 0.9f);
            positions[2] = new Vector2(6.1f, -0.1f);
            placements.Add(EnemyName.Bomb, positions);

            positions    = new Vector2[1];
            positions[0] = new Vector2(5.8f, 2.2f);
            placements.Add(EnemyName.Spit_Fire, positions);
            break;

        case EnemyName.Chupon:
            // one Ultros_Again, one Chupon
            positions    = new Vector2[1];
            positions[0] = new Vector2(1.6f, 1.0f);
            placements.Add(EnemyName.Ultros_Again, positions);

            positions    = new Vector2[1];
            positions[0] = new Vector2(5.0f, 1.7f);
            placements.Add(EnemyName.Chupon, positions);

            isBoss = true;
            bossID = EnemyName.Chupon;
            break;

        case EnemyName.Ghost:
            // Three ghosts
            positions    = new Vector2[3];
            positions[0] = new Vector2(2.9f, 2.3f);
            positions[1] = new Vector2(3.8f, 0.3f);
            positions[2] = new Vector2(5.7f, 1.7f);
            placements.Add(EnemyName.Ghost, positions);
            break;

        case EnemyName.Poplium:
            // two poplium, two whisper
            positions    = new Vector2[2];
            positions[0] = new Vector2(2.5f, 2.2f);
            positions[1] = new Vector2(4.9f, 2.9f);
            placements.Add(EnemyName.Poplium, positions);

            positions    = new Vector2[2];
            positions[0] = new Vector2(3.1f, 0.3f);
            positions[1] = new Vector2(5.5f, 0.9f);
            placements.Add(EnemyName.Whisper, positions);
            break;

        case EnemyName.Whisper:
            // three whispers
            positions    = new Vector2[3];
            positions[0] = new Vector2(2.4f, 0.2f);
            positions[1] = new Vector2(3.6f, 2.8f);
            positions[2] = new Vector2(5.5f, 0.8f);
            placements.Add(EnemyName.Whisper, positions);
            break;

        case EnemyName.Phantom_Train:
            // one Phantom_train
            positions    = new Vector2[1];
            positions[0] = new Vector2(5.22f, 1.60f);
            placements.Add(EnemyName.Phantom_Train, positions);

            isBoss = true;
            bossID = EnemyName.Phantom_Train;
            break;

        case EnemyName.Apokryphos:
            // three apokryphos
            positions    = new Vector2[3];
            positions[0] = new Vector2(0.8f, 0.9f);
            positions[1] = new Vector2(3.2f, 3.0f);
            positions[2] = new Vector2(5.3f, 0.3f);
            placements.Add(EnemyName.Apokryphos, positions);
            break;

        case EnemyName.Brainpan:
            // two brainpan, one apok, one misfit
            positions    = new Vector2[2];
            positions[0] = new Vector2(3.0f, 0.2f);
            positions[1] = new Vector2(5.8f, 0.6f);
            placements.Add(EnemyName.Brainpan, positions);

            positions    = new Vector2[1];
            positions[0] = new Vector2(2.0f, 2.5f);
            placements.Add(EnemyName.Apokryphos, positions);

            positions    = new Vector2[1];
            positions[0] = new Vector2(5.1f, 2.9f);
            placements.Add(EnemyName.Misfit, positions);
            break;

        case EnemyName.Misfit:
            // two misfit, one apok
            positions    = new Vector2[2];
            positions[0] = new Vector2(1.4f, 0.5f);
            positions[1] = new Vector2(4.0f, 2.6f);
            placements.Add(EnemyName.Misfit, positions);

            positions    = new Vector2[1];
            positions[0] = new Vector2(6.2f, 0.5f);
            placements.Add(EnemyName.Apokryphos, positions);
            break;

        case EnemyName.Wirey_Dragon:
            // three wirey dragon
            positions    = new Vector2[3];
            positions[0] = new Vector2(0.9f, 1.4f);
            positions[1] = new Vector2(4.0f, 2.8f);
            positions[2] = new Vector2(6.4f, 1.2f);
            placements.Add(EnemyName.Wirey_Dragon, positions);
            break;

        case EnemyName.Ninja:
            // two ninja, one wirey dragon
            positions    = new Vector2[2];
            positions[0] = new Vector2(1.5f, 0.5f);
            positions[1] = new Vector2(6.3f, 0.9f);
            placements.Add(EnemyName.Ninja, positions);

            positions    = new Vector2[1];
            positions[0] = new Vector2(4.0f, 2.8f);
            placements.Add(EnemyName.Wirey_Dragon, positions);
            break;

        case EnemyName.Behemoth:
            // two behemoth
            positions    = new Vector2[2];
            positions[0] = new Vector2(2.2f, 1.6f);
            positions[1] = new Vector2(5.9f, 1.6f);
            placements.Add(EnemyName.Behemoth, positions);
            break;

        case EnemyName.Dragon:
            // one dragon
            positions    = new Vector2[1];
            positions[0] = new Vector2(4.45f, 1.63f);
            placements.Add(EnemyName.Dragon, positions);
            break;

        case EnemyName.Atma_Weapon:
            // two poplium, two whisper
            positions    = new Vector2[1];
            positions[0] = new Vector2(3.27f, 1.65f);
            placements.Add(EnemyName.Atma_Weapon, positions);

            isBoss = true;
            bossID = EnemyName.Atma_Weapon;
            break;

        default:
            // user for debugging dungeons one wererat
            positions    = new Vector2[1];
            positions[0] = new Vector2(2.6f, 0.5f);
            placements.Add(EnemyName.Wererat, positions);
            break;
        }

        // Read through placements, assigning BattleIDs in the process

        // index becomes battleID. It is also the index for the list of enemies.
        int index = 0;

        // For each KIND of enemy (EnemyName)
        foreach (KeyValuePair <EnemyName, Vector2[]> pair in placements)
        {
            // Load a prefab
            GameObject enemyPrefab = Resources.Load <GameObject>(@"BattlePrefabs\Enemies\"
                                                                 + pair.Key.ToString());

            // For each enemy of this Kind (EnemyName)
            for (int i = 0; i < pair.Value.Length; i++)
            {
                // Instantiate the prefab GameObject
                GameObject enemy = GameObject.Instantiate(enemyPrefab);

                // If there are multiple enemies of this Kind, they are
                // differentiated here. (Ex: "Wererat 1", "Wererat 2")
                int choiceNumTag = 0;
                if (pair.Value.Length > 1)
                {
                    choiceNumTag = i + 1;
                }

                // Sets this single enemy as IsBoss
                bool boss = false;
                if (pair.Key == bossID)
                {
                    boss = true;
                }

                // Create a BattleEnemy and add it to the party
                BattleEnemy bEnemy = BattleEnemyData.MakeNewBattleEnemy(pair.Key);
                enemies.Add(bEnemy);

                // Provides BattleEnemy setup info (including its gameObject)
                bEnemy.LoadObjs(index, choiceNumTag, enemy, pair.Value[i], boss);

                // Sets DamageDisplay and HPMPSliders and EnemyDeath
                enemy.GetComponentInChildren <DamageDisplay>(true).SetDamageDisplay(index,
                                                                                    bEnemy.HP, bEnemy.HPMax, bEnemy.MP, bEnemy.MPMax);
                enemy.GetComponentInChildren <EnemyDeath>(true).SetID(index);

                // Proceed to the next enemy
                index++;
            }
        }
    }
Esempio n. 15
0
    }     //end f'n SpawnQuestItem)QuestItemName)

    /**A function to be called from the Quest Manager class, to return an instance of a given enemy, to be spawned from the quest manager on quest start.*/
    public GameObject SpawnEnemy(EnemyName enemy_name, Transform parent = null)
    {
        //A default value, to be overwritten
        GameObject generated_instance = this.m_RoosterPrefab;

        switch ((int)enemy_name)
        {
        //Infantry Units
        //Case Rooster
        case (int)EnemyName.ROOSTER:
        {
            if (parent != null)
            {
                generated_instance = GameObject.Instantiate(this.m_RoosterPrefab, parent);
            }
            else
            {
                generated_instance = GameObject.Instantiate(this.m_RoosterPrefab);
            }
            Rooster rooster_component = generated_instance.GetComponentInChildren <Rooster> ();
            rooster_component.m_AttackPattern.m_EnemyAttackHitAnimation = this.m_ClawAnimationPrefab;
            rooster_component.SetPlayer(this.m_Player);
            break;
        }                //end case Rooster

        //Case Armored Soldier
        case (int)EnemyName.ARMORED_SOLDIER:
        {
            if (parent != null)
            {
                generated_instance = GameObject.Instantiate(this.m_ArmoredSoldierPrefab, parent);
            }
            else
            {
                generated_instance = GameObject.Instantiate(this.m_ArmoredSoldierPrefab);
            }
            ArmoredSoldier AS_component = generated_instance.GetComponentInChildren <ArmoredSoldier> ();
            AS_component.m_AttackPattern.m_EnemyAttackHitAnimation = this.m_NormalHitAnimationPrefab;
            AS_component.SetPlayer(this.m_Player);
            break;
        }                //end case ARMORED SOLDIER

        //Case Wolf
        case (int)EnemyName.WOLF:
        {
            if (parent != null)
            {
                generated_instance = GameObject.Instantiate(this.m_WolfPrefab, parent);
            }
            else
            {
                generated_instance = GameObject.Instantiate(this.m_WolfPrefab);
            }
            Wolf WL_component = generated_instance.GetComponentInChildren <Wolf>();
            WL_component.m_AttackPattern.m_EnemyAttackHitAnimation = this.m_ClawAnimationPrefab;
            WL_component.SetPlayer(this.m_Player);
            break;
        }    //end case Wolf

        //Ranged enemies
        //Case Rooster Mage
        case (int)EnemyName.ROOSTER_MAGE:
        {
            if (parent != null)
            {
                generated_instance = GameObject.Instantiate(this.m_RoosterMagePrefab, parent);
            }
            else
            {
                generated_instance = GameObject.Instantiate(this.m_RoosterMagePrefab);
            }
            RoosterMage RM_component = generated_instance.GetComponentInChildren <RoosterMage> ();
            RM_component.m_AttackPattern.m_EnemyHitAnimation = this.m_ClawAnimationPrefab;
            RM_component.SetPlayer(this.m_Player);
            RM_component.m_AttackPattern.m_SpellAnimatorManager = this.m_SpellAnimatorManager;
            break;
        }                //end case ROOSTER MAGE

        //Boss enemies
        //Case Rooster King
        case (int)EnemyName.ROOSTER_KING:
        {
            if (parent != null)
            {
                generated_instance = GameObject.Instantiate(this.m_RoosterKingPrefab, parent);
            }
            else
            {
                generated_instance = GameObject.Instantiate(this.m_RoosterKingPrefab);
            }
            RoosterKing RK_component = generated_instance.GetComponentInChildren <RoosterKing> ();
            RK_component.m_AttackPattern.m_EnemyHitAnimation = this.m_ClawAnimationPrefab;
            RK_component.SetPlayer(this.m_Player);
            RK_component.m_AttackPattern.m_SpellAnimatorManager = this.m_SpellAnimatorManager;
            break;
        }                //end case rooster king

        //Case Orange Laird, Teine
        case (int)EnemyName.ORANGE_LAIRD:
        {
            if (parent != null)
            {
                generated_instance = GameObject.Instantiate(this.m_TeinePrefab, parent);
            }
            else
            {
                generated_instance = GameObject.Instantiate(this.m_TeinePrefab);
            }
            OrangeLaird OL_component = generated_instance.GetComponentInChildren <OrangeLaird> ();
            OL_component.m_AttackPattern.m_EnemyHitAnimation = this.m_ClawAnimationPrefab;
            OL_component.SetPlayer(this.m_Player);
            OL_component.m_AttackPattern.m_SpellAnimatorManager = this.m_SpellAnimatorManager;
            OL_component.m_AttackPattern.m_EnemyHitAnimation    = this.m_FireMeleeAnimationPrefab;
            break;
        }
        } //end switch
        return(generated_instance);
    }     //end f'n SpawnEnemy(EnemyName)