Exemplo n.º 1
0
 public void Attack(IAttack attack)
 {
     if (attack != null)
     {
         attack.Attack(_ID.ToString(), _ID, _Opponent);
     }
 }
        public async void ProcessEvent_SelectJoke_RandomName()
        {
            // Given
            var jokeService = Substitute.For <IJokeService <CategoryQuery> >();
            var nameService = Substitute.For <INameService>();
            var prompt      = Substitute.For <IPrompt>();
            var printer     = Substitute.For <IPrinter>();

            prompt.InputKey(string.Empty).Returns('r');
            prompt.Confirm("Want to use a random name? y/(n)").Returns(true);
            prompt.Confirm("Want to specify a category? y/(n)").Returns(false);
            prompt.Input("How many jokes do you want? (1-9)").Returns("1");
            nameService.GetName().Returns(Task.FromResult(ReplacedCharacterName));
            jokeService.GetRandomJoke(Arg.Any <CategoryQuery>())
            .Returns(new Joke($"{DefaultCharacterName.ToString()} Joke", DefaultCharacterName.ToString()));
            var sut = new ConsoleJokeGenerator(jokeService, nameService, prompt, printer);

            // When
            var proceed = await sut.ProcessEvent();

            // Then
            Assert.True(proceed);
            await nameService.Received(1).GetName();

            printer.Received(0).WriteLine($"{DefaultCharacterName.ToString()} Joke");
            printer.Received(1).WriteLine($"{ReplacedCharacterName.ToString()} Joke");
        }
Exemplo n.º 3
0
 private void setAnimation(CharacterAnimationState charAnimState, CharacterName character)
 {
     Actor actor = actors[character];
     String ch = "Characters/" + character.ToString().ToLower() + "/man/" + charAnimState + ".TVA";
     actor.Actor.ImportAnimations("Characters/" + character.ToString().ToLower() + "/man/" + charAnimState + ".TVA");
     actor.Actor.SetAnimationByName(charAnimState.ToString());
     actor.Actor.PlayAnimation(1);
     actor.CharacterAnimState = charAnimState;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Loads the associated assets from the defined sources and prevents further authoring of the asset
        /// </summary>
        public void LoadAssociatedAssets()
        {
            var charName = CharacterName.ToString();

            EmotionalAppraisalAsset ea = Loader(m_emotionalAppraisalAssetSource, () => new EmotionalAppraisalAsset());

            EmotionalDecisionMakingAsset edm = Loader(m_emotionalDecisionMakingAssetSource, () => new EmotionalDecisionMakingAsset());
            SocialImportanceAsset        si  = Loader(m_socialImportanceAssetSource, () => new SocialImportanceAsset());
            CommeillFautAsset            cfa = Loader(m_commeillFautAssetSource, () => new CommeillFautAsset());

            m_emotionalAppraisalAsset      = ea;
            m_emotionalDecisionMakingAsset = edm;
            m_socialImportanceAsset        = si;
            m_commeillFautAsset            = cfa;

            MCTSAsset mcts = new MCTSAsset();

            //Dynamic properties
            BindToRegistry(m_kb);
            edm.RegisterKnowledgeBase(m_kb);
            si.RegisterKnowledgeBase(m_kb);
            cfa.RegisterKnowledgeBase(m_kb);
            mcts.RegisterKnowledgeBase(m_kb);
            m_allowAuthoring = false;
        }
Exemplo n.º 5
0
 //UI callbacks
 public void OnPlay()
 {
     PlayerPrefs.SetString("DIFFICULTY", currentDifficulty.ToString());
     PlayerPrefs.SetString("CHARACTER", playerCharacter.ToString());
     StopAllCoroutines();
     StartCoroutine(Play());
 }
Exemplo n.º 6
0
    private void DividirEInserirFalas(GameObject professorGO)
    {
        var paragrafos = new string[4];

        paragrafos[0] = introducaoAula;
        paragrafos[1] = "Momento 1: " + descricaoMomento1;
        paragrafos[2] = "Momento 2: " + descricaoMomento2;
        paragrafos[3] = "Momento 3: " + descricaoMomento3;

        // Adicionar falas ao diálogo do professor
        var npc = professorGO.GetComponent <NpcDialogo>();
        var originalInteractOffset = npc.interactOffset;

        Destroy(npc);
        Destroy(professorGO.GetComponent <QuestGuest>());
        professorGO.AddComponent <QuestGuest>();
        npc = professorGO.AddComponent <NpcDialogo>();
        npc.interactOffset                    = originalInteractOffset;
        npc.dialogoPrincipal                  = new GameComenius.Dialogo.Dialogo();
        npc.dialogoPrincipal.nodulos          = new GameComenius.Dialogo.DialogoNodulo[1];
        npc.dialogoPrincipal.nodulos[0]       = new GameComenius.Dialogo.DialogoNodulo();
        npc.dialogoPrincipal.nodulos[0].falas = new GameComenius.Dialogo.Fala[1 + paragrafos.Length];

        // Fala da Lurdinha, obrigatoriamente ela deve iniciar um diálogo
        npc.dialogoPrincipal.nodulos[0].falas[0] = new GameComenius.Dialogo.Fala
        {
            // Uma fala em branco da Lurdinha é suficiente para o jogo fazer
            // um "skip" da fala dela mesmo que precise aqui no código
            fala       = "",
            personagem = GameComenius.Dialogo.Personagens.Lurdinha,
            emocao     = GameComenius.Dialogo.Expressao.Sorrindo
        };

        // Adicionar falas do professor
        for (int i = 0; i < paragrafos.Length; i++)
        {
            npc.dialogoPrincipal.nodulos[0].falas[i + 1]      = new GameComenius.Dialogo.Fala();
            npc.dialogoPrincipal.nodulos[0].falas[i + 1].fala = paragrafos[i];
            var a = Enum.Parse(typeof(GameComenius.Dialogo.Personagens), professor.ToString(), true);
            npc.dialogoPrincipal.nodulos[0].falas[i + 1].personagem = (GameComenius.Dialogo.Personagens)a;
            npc.dialogoPrincipal.nodulos[0].falas[i + 1].emocao     = GameComenius.Dialogo.Expressao.Sorrindo;
        }

        TrocarDialogoAposPlanejamento(professorGO);
    }
Exemplo n.º 7
0
    public CharacterCombatant(CharacterName characterName, int offense, int defense, int speed, int guts, int hitPoints)
        : base(characterName.ToString(), offense, defense, speed, guts, hitPoints)
    {
        this.characterName = characterName;

        // START TEST
        Weapon = new WeaponItem("Cracked Bat", ItemType.Weapon, offense: 4, guts: 0, accuracy: 15);
        // END TEST
    }
Exemplo n.º 8
0
 private string FormatJoke(CharacterName characterName, Joke joke)
 {
     if (characterName != null)
     {
         return(joke.ReplacedName(characterName.ToString()));
     }
     else
     {
         return(joke.Value);
     }
 }
Exemplo n.º 9
0
    public void PositionDialogue(DialogueGroup group, string c)
    {
        CharacterName character = ParseChar(c);

        characterUiDictionary[character].PositionDialogue(group);
#if UNITY_EDITOR
        if (!characterUiDictionary.ContainsKey(character))
        {
            Debug.LogError($"Asking to position dialogue above {character.ToString()} but they're not being shown in scene {gameObject.scene.name}");
            return;
        }
#endif
    }
Exemplo n.º 10
0
        public void LoadAssociatedAssets(AssetStorage storage)
        {
            var charName = CharacterName.ToString();

            m_emotionalAppraisalAsset      = EmotionalAppraisalAsset.CreateInstance(storage);
            m_emotionalDecisionMakingAsset = EmotionalDecisionMakingAsset.CreateInstance(storage);
            m_socialImportanceAsset        = SocialImportanceAsset.CreateInstance(storage);
            m_commeillFautAsset            = CommeillFautAsset.CreateInstance(storage);

            //Dynamic properties
            BindToRegistry(m_kb);
            m_emotionalDecisionMakingAsset.RegisterKnowledgeBase(m_kb);
            m_commeillFautAsset.RegisterKnowledgeBase(m_kb);
            m_socialImportanceAsset.RegisterKnowledgeBase(m_kb);
        }
Exemplo n.º 11
0
    private void Start()
    {
        // health bars
        HealthBar[] bars = gameObject.GetComponentsInChildren <HealthBar>();
        healthBars = new Dictionary <FighterType, HealthBar>
        {
            { FighterType.Enemy, bars[0] },
            { FighterType.Player, bars[1] }
        };
        // name
        string        preferenceKey = Game.Constants.PreferencesKeys[Preference.Character];
        CharacterName characterName = (CharacterName)PlayerPrefs.GetInt(preferenceKey);

        bars[1].Text = characterName.ToString();
    }
Exemplo n.º 12
0
        public Creature createCreature(CharacterName type, Statistics statistics)
        {
            String uniqueName = type.ToString() + id;

            Creature creature = new Creature(container.getObject<Game>("mainGame"));
            creature.UniqueName = uniqueName;
            creature.Statistics = statistics;
            creature.CreatureService = this;
            creature.CharacterName = type;
            creature.AnimationService = container.getObject<AnimationService>("animationService");

            container.addComponent(creature, uniqueName);
            creatures.Add(uniqueName, creature);
            id++;
            return creature;
        }
Exemplo n.º 13
0
        public Player(string name, int hitChance, int evade, int life, int maxLife, Name charactername, Weapon weaponchoice)
        {
            maxLife       = maxLife;
            Name          = name;
            HitChance     = hitChance;
            Evade         = Evade;
            Life          = life;
            CharacterName = CharacterName;
            WeaponChoice  = WeaponChoice;

            switch (CharacterName.ToString())
            {
            case "PawKC":
                HitChance += 5;
                break;

            case "Robuck":
                HitChance += 5;
                break;

            case Name.CaptainPrice:
                HitChance += 15;
                break;

            case Name.AlexMason:
                HitChance += 10;
                break;

            case Name.Ghost:
                HitChance += 5;
                break;

            case Name.GeneralShepherd:
                HitChance += 10;
                break;

            case Name.CaptainWoods:
                HitChance += 10;
                break;

            default:
                break;
            }
        }
Exemplo n.º 14
0
        protected virtual void OnTryMeleeAttackDelay()
        {
            RaycastHit _hit;
            var        _target    = enemyTarget;
            bool       _validShot = ChestTransform != null &&
                                    _target != null;

            if (_validShot && Physics.Linecast(MyLOSTransform.position, _target.ChestTransform.position, out _hit))
            {
                var _root = _hit.transform.root;
                //If Hit Self
                if (_root == transform)
                {
                    Debug.Log(CharacterName.ToString()
                              + " is shooting himself.");
                }
                bool _isEnemy = _root.tag == gamemode.AllyTag;
                if (_isEnemy)
                {
                    _target.allyEventHandler.CallOnAllyTakeDamage(
                        GetDamageRate(), _hit.point, Vector3.zero, this, _hit.transform.gameObject);
                }
            }
        }
 void SubscribeToEventBus()
 {
     EventBus.ClientInstance.Subscribe(EventConstants.UpdateCharacterSheet(charaName.ToString()), UpdateInfo);
 }
Exemplo n.º 16
0
        public JSONNode GetCharacterJSONNode(CharacterName characterName)
        {
            string JSONfilePath = _charactersDataFilesDirectory[characterName.ToString()];

            return(JSON.Parse(((TextAsset)Resources.Load(JSONfilePath)).text));
        }