示例#1
0
    private void SpawnNPCMock(string vehicleId, NPCS npcData, int npcControllerSeed, Color color, Vector3 position, Quaternion rotation)  // TODO can this use SpawnNPC method?
    {
        var go = new GameObject("NPC " + vehicleId);

        go.SetActive(false);
        go.transform.SetParent(transform);
        go.layer = LayerMask.NameToLayer("NPC");
        go.tag   = "Car";
        var rb = go.AddComponent <Rigidbody>();

        rb.mass                   = 2000;
        rb.interpolation          = RigidbodyInterpolation.Interpolate;
        rb.collisionDetectionMode = CollisionDetectionMode.Discrete;
        rb.position               = position;
        rb.rotation               = rotation;
        go.transform.SetPositionAndRotation(position, rotation);
        go.AddComponent <NPCController>();
        var npc_name = Instantiate(npcData.Prefab, go.transform).name;

        go.name = npc_name + vehicleId;
        var NPCController = go.GetComponent <NPCController>();

        NPCController.Size     = npcData.NPCType;
        NPCController.NPCColor = color;
        NPCController.NPCLabel = GetNPCLabel(npc_name);
        NPCController.id       = vehicleId;
        NPCController.Init(NPCSeedGenerator.Next());
        CurrentPooledNPCs.Add(NPCController);

        SimulatorManager.Instance.UpdateSegmentationColors(go);

        //Add required components for cluster simulation
        ClusterSimulationUtilities.AddDistributedComponents(go);
    }
示例#2
0
 public Level1() :
     base(Environment.Explosion1X, Environment.Explosion1Y, Environment.Mario1X, Environment.Mario1Y)
 {
     logicToken    = new CancellationTokenSource();
     generateToken = new CancellationTokenSource();
     background    = Properties.Resources.back;
     passPoints    = 4;
     NPCS.Add(new Princess(Environment.Princess1X, Environment.Princess1Y));
     NPCS.Add(new Mushroom(Environment.Mushroom1X, Environment.Mushroom1Y));
 }
示例#3
0
 private void LookupFightByNPCID(int IDLOOKUP)
 {
     _NpcList = _nPCS.GetNPCS();
     foreach (NPCS nPCS in _NpcList)
     {
         if (nPCS.NPCID == IDLOOKUP)
         {
             currentFlight = nPCS;
         }
     }
 }
示例#4
0
文件: Level2.cs 项目: Ernest96/APPOO
 public Level2() :
     base(Environment.Explosion2X, Environment.Explosion2Y, Environment.Mario2X, Environment.Mario2Y)
 {
     logicToken    = new CancellationTokenSource();
     generateToken = new CancellationTokenSource();
     background    = Properties.Resources.back2;
     passPoints    = 8;
     NPCS.Add(new Princess(Environment.Princess2X, Environment.Princess2Y));
     NPCS.Add(new Mushroom(Environment.Mushroom2X, Environment.Mushroom2Y));
     NPCS.Add(new Dragon(Environment.Dragon2X, Environment.Dragon2Y));
 }
示例#5
0
    public override void PrepareMinigameObjects()
    {
        StageElementsToModify = GameObject.FindGameObjectsWithTag("Disable_BossBattle");
        foreach (var ele in StageElementsToModify)
        {
            ele.SetActive(false);
        }
        BossMonster boss_instance = Instantiate(Boss);

        boss_instance.Initialize();
        NPCS.Add(boss_instance.GetComponent <BossMonster>());
    }
示例#6
0
        /// <summary>
        ///
        /// </summary>
        void Awake()
        {
            npcDialogs      = SceneResourceReader.GetMidgardResource <NPCS>(SceneResourceReader.MidgardNPC);
            artifactDialogs = SceneResourceReader.GetMidgardResource <Artifacts>(SceneResourceReader.MidgardArtficats);

            artifactByName = new Dictionary <string, Artifact>();
            npcByName      = new Dictionary <string, NPC>();

            //Konvertiere
            ConvertListsToDictionary <Artifact>(artifactDialogs.artifactListe);
            ConvertListsToDictionary <NPC>(npcDialogs.npcListe);
        }
示例#7
0
        public override NPC ChooseNpc()
        {
            Random random = new Random();
            var    r      = random.Next(1, 100);

            if (r >= 75)
            {
                return(NPCS.ElementAt(0));
            }
            else
            {
                return(NPCS.ElementAt(1));
            }
        }
示例#8
0
    private BytesStack GetSpawnMessage(string vehicleId, NPCS npcData,
                                       int npcControllerSeed, Color color, Vector3 position, Quaternion rotation)
    {
        var bytesStack    = new BytesStack();
        var indexOfPrefab = NPCVehicles.FindIndex(npc => npc.Equals(npcData));

        bytesStack.PushCompressedRotation(rotation);
        bytesStack.PushCompressedPosition(position);
        bytesStack.PushCompressedColor(color, 1);
        bytesStack.PushInt(npcControllerSeed);
        bytesStack.PushInt(indexOfPrefab, 2);
        bytesStack.PushString(vehicleId);
        bytesStack.PushEnum <NPCManagerCommandType>((int)NPCManagerCommandType.SpawnNPC);
        return(bytesStack);
    }
示例#9
0
    private void SpawnNPC(string vehicleId, NPCS npcData, Color color, int npcControllerSeed)
    {
        var genId = vehicleId;
        var go    = new GameObject("NPC " + genId);

        go.SetActive(false);
        go.transform.SetParent(transform);
        go.layer = LayerMask.NameToLayer("NPC");
        go.tag   = "Car";
        var rb = go.AddComponent <Rigidbody>();

        rb.mass                   = 2000;
        rb.interpolation          = RigidbodyInterpolation.Interpolate;
        rb.collisionDetectionMode = CollisionDetectionMode.Discrete;
        go.AddComponent <NPCController>();
        var npc_name = Instantiate(npcData.Prefab, go.transform).name;

        go.name = npc_name + genId;
        var NPCController = go.GetComponent <NPCController>();

        NPCController.Size     = npcData.NPCType;
        NPCController.NPCColor = color;
        NPCController.NPCLabel = GetNPCLabel(npc_name);
        NPCController.id       = genId;
        NPCController.Init(NPCSeedGenerator.Next());
        CurrentPooledNPCs.Add(NPCController);

        SimulatorManager.Instance.UpdateSemanticTags(go);
        //Add required components for distributing rigidbody from master to clients
        if (SimulatorManager.Instance.Network.IsMaster)
        {
            if (go.GetComponent <DistributedObject>() == null)
            {
                go.AddComponent <DistributedObject>();
            }
            if (rb.gameObject.GetComponent <DistributedRigidbody>() == null)
            {
                rb.gameObject.AddComponent <DistributedRigidbody>();
            }
            BroadcastMessage(new Message(Key,
                                         GetSpawnMessage(genId, npcData, npcControllerSeed, color, rb.position, rb.rotation),
                                         MessageType.ReliableUnordered));
        }
    }
示例#10
0
    private void SpawnNPCMock(string vehicleId, NPCS npcData, int npcControllerSeed, Color color,
                              Vector3 position, Quaternion rotation)
    {
        var go = new GameObject("NPC " + vehicleId);

        go.SetActive(false);
        go.transform.SetParent(transform);
        go.layer = LayerMask.NameToLayer("NPC");
        go.tag   = "Car";
        var rb = go.AddComponent <Rigidbody>();

        rb.mass                   = 2000;
        rb.interpolation          = RigidbodyInterpolation.Interpolate;
        rb.collisionDetectionMode = CollisionDetectionMode.Discrete;
        rb.position               = position;
        rb.rotation               = rotation;
        go.AddComponent <NPCController>();
        var npc_name = Instantiate(npcData.Prefab, go.transform).name;

        go.name = npc_name + vehicleId;
        var NPCController = go.GetComponent <NPCController>();

        NPCController.Size     = npcData.NPCType;
        NPCController.NPCColor = color;
        NPCController.NPCLabel = GetNPCLabel(npc_name);
        NPCController.id       = vehicleId;
        NPCController.Init(NPCSeedGenerator.Next());
        CurrentPooledNPCs.Add(NPCController);

        SimulatorManager.Instance.UpdateSemanticTags(go);

        //Add required components for distributing rigidbody from master to clients
        if (go.GetComponent <MockedObject>() == null)
        {
            go.AddComponent <MockedObject>().Initialize();
        }
        if (rb.gameObject.GetComponent <MockedRigidbody>() == null)
        {
            rb.gameObject.AddComponent <MockedRigidbody>();
        }
    }
示例#11
0
    private DistributedMessage GetSpawnMessage(string vehicleId, NPCS npcData,
                                               int npcControllerSeed, Color color, Vector3 position, Quaternion rotation)
    {
        var message = MessagesPool.Instance.GetMessage(
            ByteCompression.RotationMaxRequiredBytes +
            ByteCompression.PositionRequiredBytes +
            12 +
            BytesStack.GetMaxByteCount(vehicleId));
        var indexOfPrefab = NPCVehicles.FindIndex(npc => npc.Equals(npcData));

        message.AddressKey = Key;
        message.Content.PushCompressedRotation(rotation);
        message.Content.PushCompressedPosition(position);
        message.Content.PushCompressedColor(color, 1);
        message.Content.PushInt(npcControllerSeed);
        message.Content.PushInt(indexOfPrefab, 2);
        message.Content.PushString(vehicleId);
        message.Content.PushEnum <NPCManagerCommandType>((int)NPCManagerCommandType.SpawnNPC);
        message.Type = DistributedMessageType.ReliableOrdered;
        return(message);
    }
示例#12
0
        private void SpawnPeople(EntityStateSystem entityStateSystem)
        {
            var spawnPointPosition = Locations.OutsideDoorLocation();

            NPCS.SpawnNpc(entityStateSystem, NPCS.Q, spawnPointPosition);
            NPCS.SpawnNpc(entityStateSystem, NPCS.Tolstoy, spawnPointPosition);
            NPCS.SpawnNpc(entityStateSystem, NPCS.Jannet, spawnPointPosition);
            NPCS.SpawnNpc(entityStateSystem, NPCS.McGraw, spawnPointPosition);
            NPCS.SpawnNpc(entityStateSystem, NPCS.Ellie, spawnPointPosition);
            NPCS.SpawnNpc(entityStateSystem, NPCS.GenerateAnon(SpeciesType.Human), spawnPointPosition);
            NPCS.SpawnNpc(entityStateSystem, NPCS.GenerateAnon(SpeciesType.Human), spawnPointPosition);
            NPCS.SpawnNpc(entityStateSystem, NPCS.GenerateAnon(SpeciesType.Human), spawnPointPosition);
            NPCS.SpawnNpc(entityStateSystem, NPCS.GenerateAnon(SpeciesType.Human), spawnPointPosition);
            NPCS.SpawnNpc(entityStateSystem, NPCS.GenerateAnon(SpeciesType.BirdPerson), spawnPointPosition);
            NPCS.SpawnNpc(entityStateSystem, NPCS.GenerateAnon(SpeciesType.ShadowPerson), spawnPointPosition);

            NPCS.SpawnNpc(entityStateSystem, NPCS.GenerateHallwayWalker(), Locations.RandomHallwayEndLocation());
            NPCS.SpawnNpc(entityStateSystem, NPCS.GenerateHallwayWalker(), Locations.RandomHallwayEndLocation());
            NPCS.SpawnNpc(entityStateSystem, NPCS.GenerateHallwayWalker(), Locations.RandomHallwayEndLocation());
            NPCS.SpawnNpc(entityStateSystem, NPCS.GenerateHallwayWalker(), Locations.RandomHallwayEndLocation());
        }
示例#13
0
        private void Fight(CharacterSuperModel u, NPCS enemy)
        {
            CharacterSuperModel CurrentStatus = u;
            NPCS EnemyCurrentStatus           = enemy;
            int  yourATK = 0;

            while (CurrentStatus.CharacterHealth > 0 && EnemyCurrentStatus.HP > 0)
            {
Repeat:
                GameService.NewPage($"\n{EnemyCurrentStatus.NPCName}\n" +
                                    $"Hp:{EnemyCurrentStatus.HP}/{enemy.HP}\n\n\n\n\n" +
                                    $"{CurrentStatus.CharacterName}\n" +
                                    $"Hp: {CurrentStatus.CharacterHealth}/{CurrentStatus.CharacterMaxHealth}\n" +
                                    "[1. Attack]\n" +
                                    "[2. Drink Hp Pot]: " + (CurrentStatus.PotionCount) + " Remaining \n" +
                                    "[3. Run]\n"
                                    , "battle");
                char response = Console.ReadKey().KeyChar;

                switch (response)
                {
                case '1':
                {
                    EnemyCurrentStatus.HP -= YourAtkResult(DisplayAndPickAtkOptions(_characterSuperModel.CharacterAttacks).DMG);
                    break;
                }

                case '2':
                {
                    if (CurrentStatus.PotionCount > 0)
                    {
                        CurrentStatus.PotionCount--;
                        if (CurrentStatus.CharacterHealth != CurrentStatus.CharacterMaxHealth)
                        {
                            if ((CurrentStatus.CharacterHealth + 10) <= CurrentStatus.CharacterMaxHealth)
                            {
                                CurrentStatus.CharacterHealth += 10;
                            }
                            else
                            {
                                CurrentStatus.CharacterHealth = CurrentStatus.CharacterMaxHealth;
                            }
                            Console.WriteLine("You Feel Better.");
                        }
                        else
                        {
                            Console.WriteLine("You're already at max health.");
                            goto Repeat;
                        }
                        Console.ReadLine();
                    }
                    else
                    {
                        Console.WriteLine("You are out of Potions!");
                        Console.ReadLine();
                        goto Repeat;
                    }
                    break;
                }

                case '3':
                {
                    Console.WriteLine("You Ran...");
                    Console.ReadLine();
                    goto EndFight;
                }

                default:
                {
                    goto Repeat;
                }
                }
                if (enemy.HP >= 1)
                {
                    EnemyAtk(enemy.ATK);
                }
            }
            if (_characterSuperModel.CharacterHealth > 0)
            {
                _characterSuperModel.CharacterLevel++;
                _characterSuperModel.CharacterBaseHealth += 2;
                _characterSuperModel.CharacterMaxHealth  += 2;
                _characterSuperModel.CharacterHealth      = _characterSuperModel.CharacterMaxHealth;
                _characterSuperModel.Gold += ((enemy.ATK) * 2);
            }
            else
            {
                _characterSuperModel.IsDead = true;
            }
            EndFight :;
        }
示例#14
0
        internal Data Create(Row _Row)
        {
            Data _Data;

            switch (this.Index)
            {
            case 1:
                _Data = new Abilities(_Row, this);
                break;

            case 2:
                _Data = new Achievements(_Row, this);
                break;

            case 3:
                _Data = new Alliance_Badges(_Row, this);
                break;

            case 4:
                _Data = new Alliance_Roles(_Row, this);
                break;

            case 5:
                _Data = new Area_Effect(_Row, this);
                break;

            case 6:
                _Data = new Arenas(_Row, this);
                break;

            case 7:
                _Data = new Buildings(_Row, this);
                break;

            case 8:
                _Data = new Character_Buffs(_Row, this);
                break;

            case 9:
                _Data = new Characters(_Row, this);
                break;

            case 10:
                _Data = new Chest_Order(_Row, this);
                break;

            case 11:
                _Data = new Configuration_Definitions(_Row, this);
                break;

            case 12:
                _Data = new Content_Tests(_Row, this);
                break;

            case 13:
                _Data = new Decos(_Row, this);
                break;

            case 14:
                _Data = new Draft_Deck(_Row, this);
                break;

            case 15:
                _Data = new Event_Categories(_Row, this);
                break;

            case 16:
                _Data = new Event_Category_Definitions(_Row, this);
                break;

            case 17:
                _Data = new Event_Category_Enums(_Row, this);
                break;

            case 18:
                _Data = new Event_Category_Object_Definitions(_Row, this);
                break;

            case 19:
                _Data = new Exp_Levels(_Row, this);
                break;

            case 20:
                _Data = new Gamble_Chests(_Row, this);
                break;

            case 21:
                _Data = new Game_Modes(_Row, this);
                break;

            case 22:
                _Data = new Globals(_Row, this);
                break;

            case 23:
                _Data = new Heroes(_Row, this);
                break;

            case 24:
                _Data = new Locales(_Row, this);
                break;

            case 25:
                _Data = new Locations(_Row, this);
                break;

            case 26:
                _Data = new NPCS(_Row, this);
                break;

            case 27:
                _Data = new Predefined_Decks(_Row, this);
                break;

            case 28:
                _Data = new Projectiles(_Row, this);
                break;

            case 29:
                _Data = new Rarities(_Row, this);
                break;

            case 30:
                _Data = new Regions(_Row, this);
                break;

            case 31:
                _Data = new Resource_Packs(_Row, this);
                break;

            case 32:
                _Data = new Resources(_Row, this);
                break;

            case 33:
                _Data = new Shop(_Row, this);
                break;

            case 34:
                _Data = new Spell_Sets(_Row, this);
                break;

            case 35:
                _Data = new Spells_Buildings(_Row, this);
                break;

            case 36:
                _Data = new Spells_Characters(_Row, this);
                break;

            case 37:
                _Data = new Spells_Heroes(_Row, this);
                break;

            case 38:
                _Data = new Spells_Others(_Row, this);
                break;

            case 39:
                _Data = new Survival_Modes(_Row, this);
                break;

            case 40:
                _Data = new Taunts(_Row, this);
                break;

            case 41:
                _Data = new Tournament_Tiers(_Row, this);
                break;

            case 42:
                _Data = new Treasure_Chests(_Row, this);
                break;

            case 43:
                _Data = new Tutorials_Home(_Row, this);
                break;

            case 44:
                _Data = new Tutorial_NPC(_Row, this);
                break;

            default:
            {
                _Data = new Data(_Row, this);
                break;
            }
            }

            return(_Data);
        }
示例#15
0
 public NPCLoaderTest()
 {
     midgardNPCS = SceneResourceReader.GetMidgardResource <NPCS> (SceneResourceReader.MidgardNPCTest);
 }
示例#16
0
 public DialogParserFertigkeitTest()
 {
     midgardNPCSorig = SceneResourceReader.GetMidgardResource <NPCS> (SceneResourceReader.MidgardNPC);
     midgardNPCS     = SceneResourceReader.GetMidgardResource <NPCS> (SceneResourceReader.MidgardNPCTest);
     midgardNPCS2    = SceneResourceReader.GetMidgardResource <NPCS> (SceneResourceReader.MidgardNPCTest2);
 }