Example #1
0
        private async Task SignInAsync(AccessTokenDetails accessToken, CharacterDetails character)
        {
            if (accessToken == null)
            {
                throw new ArgumentNullException(nameof(accessToken));
            }
            if (character == null)
            {
                throw new ArgumentNullException(nameof(character));
            }

            var claims = new List <Claim> {
                new Claim(ClaimTypes.NameIdentifier, character.CharacterId.ToString()),
                new Claim(ClaimTypes.Name, character.CharacterName),
                new Claim("AccessToken", accessToken.AccessToken),
                new Claim("RefreshToken", accessToken.RefreshToken ?? ""),
                new Claim("AccessTokenExpiry", accessToken.ExpiresUtc.ToString()),
                new Claim("Scopes", character.Scopes)
            };

            var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);

            await HttpContext.SignInAsync(
                CookieAuthenticationDefaults.AuthenticationScheme,
                new ClaimsPrincipal(claimsIdentity),
                new AuthenticationProperties { IsPersistent = true, ExpiresUtc = DateTime.UtcNow.AddHours(24) });
        }
    //This version of attack is called by the player
    public void Attack(RaycastHit newTarget)
    {
        if (health <= 0)
        {
            Debug.Log("Dead Characters can't attack");
            return;
        }
        if (energy < attackCost)
        {
            Debug.Log("This character does not have enough energy to attack.");
            return;
        }
        GameObject       attTarget        = GameObject.Find(newTarget.transform.name);
        CharacterDetails targetController = attTarget.GetComponent <CharacterDetails>();
        Rigidbody        targetBody       = attTarget.GetComponent <Rigidbody>();
        float            distance         = Vector3.Distance(characterBody.position, targetBody.position);

        if (distance > range)
        {
            Debug.Log("Target is out of attack range");
            return;
        }

        energy -= attackCost;
        anim.SetTrigger("IsAttacking");
        targetController.TakeDamage(power);
    }
Example #3
0
        public ActionResult Edit(int id)
        {
            var service = CharacterServices();
            var detail  = service.GetCharacterByID(id);
            var model   =
                new CharacterDetails
            {
                OwnerID              = detail.OwnerID,
                CharacterID          = detail.CharacterID,
                CharacterName        = detail.CharacterName,
                CharacterStr         = detail.CharacterStr,
                CharacterDex         = detail.CharacterDex,
                CharacterCon         = detail.CharacterCon,
                CharacterInt         = detail.CharacterInt,
                CharacterWis         = detail.CharacterWis,
                CharacterCha         = detail.CharacterCha,
                CharacterRace        = detail.CharacterRace,
                CharacterClass       = detail.CharacterClass,
                CharacterAbilities   = detail.CharacterAbilities,
                CharacterXP          = detail.CharacterXP,
                CharacterLevel       = detail.CharacterLevel,
                CharacterAC          = detail.CharacterAC,
                CharacterHP          = detail.CharacterHP,
                HitPointRange        = detail.HitPointRange,
                CharacterAttackBonus = detail.CharacterAttackBonus,
                CharacterNotes       = detail.CharacterNotes
            };

            return(View(model));
        }
Example #4
0
    public bool RemoveAgent(CharacterDetails charDetails)
    {
        throw new UnityException("Can't yet handle the removal of agents. If this is neccessary, we'll need to look at a way of making IDs more dynamic.");

        //targetTransforms.RemoveAt(charDetails.AgentID);
        //return agents.RemoveAt(charDetails.AgentID);
    }
Example #5
0
    void RightClick()
    {
        if (!character)
        {
            //Debug.Log("No character selected.");
            return;
        }

        Ray ray;

        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit       hit;
        CharacterDetails controller = character.GetComponent <CharacterDetails>();

        if (Physics.Raycast(ray, out hit))
        {
            //Attacking
            if (hit.transform.tag == "Character")
            {
                Debug.Log(character.name + " is attacking " + hit.transform.name);
                controller.Attack(hit);
            }
            //Moving
            else if (Physics.Raycast(ray, out hit, 100f, terrainMask))
            {
                Debug.Log("Move to " + hit.point.x + "," + hit.point.y + "," + hit.point.z);
                controller.Move(hit);
            }
        }
    }
Example #6
0
    // Spawns the "list of characters"
    void Start()
    {
        content.sizeDelta = new Vector2(numberOfCharacters * 65, 0);

        for (int i = 0; i < numberOfCharacters; i++)
        {
            // 60 width of item
            float nextPosition = i * 75;

            Vector3 nextChar = new Vector3(nextPosition, 29.035f, SpawnPoint.position.z);

            SpawnedCharacters[i] = Instantiate(characterBox, nextChar, SpawnPoint.rotation);
            SpawnedCharacters[i].transform.SetParent(SpawnPoint, false);

            characterDetails = SpawnedCharacters[i].GetComponent <CharacterDetails>();
            characterDetails.characterName.text = characters[i].name;

            Image pic = characterDetails.characterPic.GetComponent <Image>();
            pic.sprite = characters[i].characterHeadshot;

            characterDetails.fullChar.sprite     = characters[i].characterFullBody;
            characterDetails.characterBox.sprite = box.sprite;
            characterDetails.character           = characters[i];
        }
    }
    //This version of attack is called by a Strategy
    public int Attack(GameObject target)
    {
        if (health <= 0)
        {
            Debug.Log("Dead Characters can't attack");
            return(-1);
        }
        if (energy < attackCost)
        {
            Debug.Log("This character does not have enough energy to attack.");
            return(-2);
        }
        CharacterDetails targetController = target.GetComponent <CharacterDetails>();
        Rigidbody        targetBody       = target.GetComponent <Rigidbody>();
        float            distance         = Vector3.Distance(characterBody.position, targetBody.position);

        if (distance > range)
        {
            Debug.Log("Target is out of attack range");
            return(-3);
        }

        energy -= attackCost;
        anim.SetTrigger("IsAttacking");
        targetController.TakeDamage(power);

        return(1);
    }
        public async Task <IActionResult> Login(LoginViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                var result = await _signInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe, lockoutOnFailure : false);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User logged in.");
                    if (TempData.Peek("AssociateCharacterWithRegistration") != null)
                    {
                        try
                        {
                            CharacterDetails character = JsonConvert.DeserializeObject <CharacterDetails>(TempData["AssociateCharacterWithRegistration"].ToString());
                            ApplicationUser  user      = _userManager.FindByNameAsync(model.UserName).Result;
                            _profileManager.AssociateCharacter(user, character);
                        }
                        catch (Exception)
                        {
                            _logger.LogError("Unable to associate character when logging in with existing account");
                        }
                    }
                    return(RedirectToLocal(returnUrl));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Invalid login attempt.");
                    return(View(model));
                }
            }

            return(View(model));
        }
Example #9
0
    public AgentInventory(CognitiveAgent Owner)
    {
        OwnerDetails = Owner.CharDetails;
        OwnerCue = Owner.CharacterCue;
        OwnerMind = Owner.MindsEye;

        EquippedUID = string.Empty;
    }
Example #10
0
    public AgentInventory(PlayerController Owner)
    {
        OwnerDetails = Owner.CharDetails;
        OwnerCue = Owner.CharacterCue;
        OwnerMind = Owner.MindsEye;

        EquippedUID = string.Empty;
    }
Example #11
0
        private static void SendCharacterDetails(WorldClient client, DbCharacter character)
        {
            using var packet = new Packet(PacketType.CHARACTER_DETAILS);
            var bytes = new CharacterDetails(character).Serialize();

            packet.Write(bytes);
            client.SendPacket(packet);
        }
        private void SeeCharacter(string pName)
        {
            ActualCharacter = InitialListCharacters.Where(x => x.Name == pName).FirstOrDefault();

            ContentPage cd = new CharacterDetails();

            App.Current.MainPage.Navigation.PushAsync(cd);
        }
Example #13
0
        public CharacterSheet()
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.Filter = "XML File|*.xml";
                ofd.Title  = "Open Character";

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    using (var characterSheet = ofd.OpenFile())
                    {
                        XmlSerializer mySerializer = new XmlSerializer(typeof(CharacterDetails));
                        Character = (CharacterDetails)mySerializer.Deserialize(characterSheet);
                    }
                }
                else
                {
                    Character = new CharacterDetails();
                }
            }
            InitializeComponent();

            BAB.DataBindings.Add("Text", Character, "BAB");

            StrScore.DataBindings.Add("Text", Character.CharacterAttributes.Str, "AbilityScore");
            DexScore.DataBindings.Add("Text", Character.CharacterAttributes.Dex, "AbilityScore");
            ConScore.DataBindings.Add("Text", Character.CharacterAttributes.Con, "AbilityScore");
            IntScore.DataBindings.Add("Text", Character.CharacterAttributes.Int, "AbilityScore");
            WisScore.DataBindings.Add("Text", Character.CharacterAttributes.Wis, "AbilityScore");
            ChaScore.DataBindings.Add("Text", Character.CharacterAttributes.Cha, "AbilityScore");


            strEnhBonus.DataBindings.Add("Text", Character.CharacterAttributes.Str, "EnhancementBonus",
                                         true, DataSourceUpdateMode.OnPropertyChanged);
            dexEnhBonus.DataBindings.Add("Text", Character.CharacterAttributes.Dex, "EnhancementBonus",
                                         true, DataSourceUpdateMode.OnPropertyChanged);
            conEnhBonus.DataBindings.Add("Text", Character.CharacterAttributes.Con, "EnhancementBonus",
                                         true, DataSourceUpdateMode.OnPropertyChanged);
            intEnhBonus.DataBindings.Add("Text", Character.CharacterAttributes.Int, "EnhancementBonus",
                                         true, DataSourceUpdateMode.OnPropertyChanged);
            wisEnhBonus.DataBindings.Add("Text", Character.CharacterAttributes.Wis, "EnhancementBonus",
                                         true, DataSourceUpdateMode.OnPropertyChanged);
            chaEnhBonus.DataBindings.Add("Text", Character.CharacterAttributes.Cha, "EnhancementBonus",
                                         true, DataSourceUpdateMode.OnPropertyChanged);

            strTempMod.DataBindings.Add("Text", Character.CharacterAttributes.Str, "TemporaryModifier",
                                        true, DataSourceUpdateMode.OnPropertyChanged);
            dexTempMod.DataBindings.Add("Text", Character.CharacterAttributes.Dex, "TemporaryModifier",
                                        true, DataSourceUpdateMode.OnPropertyChanged);
            conTempMod.DataBindings.Add("Text", Character.CharacterAttributes.Con, "TemporaryModifier",
                                        true, DataSourceUpdateMode.OnPropertyChanged);
            intTempMod.DataBindings.Add("Text", Character.CharacterAttributes.Int, "TemporaryModifier",
                                        true, DataSourceUpdateMode.OnPropertyChanged);
            wisTempMod.DataBindings.Add("Text", Character.CharacterAttributes.Wis, "TemporaryModifier",
                                        true, DataSourceUpdateMode.OnPropertyChanged);
            chaTempMod.DataBindings.Add("Text", Character.CharacterAttributes.Cha, "TemporaryModifier",
                                        true, DataSourceUpdateMode.OnPropertyChanged);
        }
    public void displayDetails(CharacterDetails details)
    {
        detailsUI.SetActive(true);

        iconUI.sprite    = details.icon;
        nameUI.text      = details.name;
        statsUI.text     = details.stats;
        abilitiesUI.text = details.abilities;
    }
Example #15
0
        public CharacterSheet(FileStream characterSheet)
        {
            InitializeComponent();
            //TODO: once I have a window for loading in a character, deserialize the XML there and pass in the object
            //that way I can do error handling before opening the window
            XmlSerializer mySerializer = new XmlSerializer(typeof(CharacterDetails));

            Character = (CharacterDetails)mySerializer.Deserialize(characterSheet);
        }
Example #16
0
 private void UpdateXPEditElements()
 {
     try {
         LevelSlider.Value   = Model.Save.Details.Level;
         XPSlider.Maximum    = (CharacterDetails.ExperienceToLevel(Model.Save.Details.Level + 1) - 1).Clamp(0, int.MaxValue);
         XPSlider.Value      = Model.Save.Details.LevelExperience;
         TotalXPSlider.Value = Model.Save.Details.TotalExperience;
     } catch (NullReferenceException) { }
 }
Example #17
0
    void Awake()
    {
        Transform = GetComponent<Transform>();
        Self = gameObject;
        CharDetails = GetComponent<CharacterDetails>();

        Animation = GetComponent<Animation>();
        ViewController = GetComponent<HeadLookController>();
    }
Example #18
0
 public DeathState(CharacterDetails dets) : base(dets)
 {
     if (!isDieing)
     {
         details.animator.SetTrigger("toDeath");
         details.PlaySFX("death");
         isDieing  = true;
         deathTime = details.deathTime;
     }
 }
Example #19
0
        public void AssociateCharacter(ClaimsPrincipal principal, int characterId)
        {
            CharacterDetails characterDetails = _characterRepository.GetCharacter(characterId);
            ApplicationUser  user             = _userManager.GetUserAsync(principal).Result;

            if (string.Equals(characterDetails.AccountID, user.Id.ToString()))
            {
                SetCharacterAsPrimary(user, characterDetails);
            }
        }
Example #20
0
        public async Task <IActionResult> Callback()
        {
            Emsservice = new scopesservice(Path.Combine(_hostingEnvironment.WebRootPath, @"res\emsscopes.ems"));
            Emsservice.GetScopes();
            EmsIniservice = new iniservice(Path.Combine(_hostingEnvironment.WebRootPath, @"res\cfg.xml"));
            EmsApi        = new EVEStandardAPI("EMS", DataSource.Tranquility, new TimeSpan(0, 5, 0), EmsIniservice.CallbackUrl, EmsIniservice.ClientId, EmsIniservice.SecretKey);
            Model         = EmsApi.SSO.AuthorizeToEVEURI(Emsservice.scopes, "ems");

            Model.AuthorizationCode = Request.Query["code"];
            Model.ReturnedState     = Request.Query["state"];
            //Model.ExpectedState= "ems";
            AccessTokenDetails token = await EmsApi.SSO.VerifyAuthorizationAsync(Model);

            ViewData["access_token"]  = token.AccessToken;
            ViewData["expires_in"]    = token.ExpiresIn;
            ViewData["refresh_token"] = token.RefreshToken;
            ViewData["expires"]       = token.Expires;
            CharacterDetails character = await EmsApi.SSO.GetCharacterDetailsAsync(token.AccessToken);

            ViewData["CharacterID"]        = character.CharacterID;
            ViewData["CharacterName"]      = character.CharacterName;
            ViewData["ExpiresOn"]          = character.ExpiresOn;
            ViewData["Scopes"]             = character.Scopes;
            ViewData["TokenType"]          = character.TokenType;
            ViewData["CharacterOwnerHash"] = character.CharacterOwnerHash;

            AuthDTO authDTOems = new AuthDTO
            {
                AccessToken = token,
                Character   = character
            };
            List <CharacterMining> mininglist = new List <CharacterMining>();
            long pages = 0;

            try
            {
                (mininglist, pages) = await EmsApi.Industry.CharacterMiningLedgerV1Async(authDTOems, 1);
            }
            catch (Exception e)
            {
                ViewData["emessage"] = e.Message.ToString();;
                ViewData["error"]    = e.ToString();;
                ViewData["data"]     = e.Data.ToString();
                return(View());
            }
            mininglist.ToArray();
            string image  = "https://imageserver.eveonline.com/Character/" + character.CharacterID + "_512.jpg";
            Uri    imguri = new Uri(image);

            ViewData["image"] = imguri;
            return(View(mininglist));
        }
 void Awake()
 {
     Debug.Log("Checking for existing character details");
     if (CharacterDetails_ == null)
     {
         DontDestroyOnLoad(gameObject);
         CharacterDetails_ = this;
         Debug.Log("Character details do not exist, creating character details");
     }
     else if (CharacterDetails_ != this)
     {
         Debug.Log("Character details exists, deleting spare gameobject");
         Destroy(gameObject);
     }
 }
Example #22
0
        public void AddCharacterToAccount(ApplicationUser user, CharacterDetails character)
        {
            CharacterDetails exists = GetCharacter(character.CharacterID);

            if (exists == null)
            {
                character.AccountID = user.Id;
                db.CharacterDetails.Add(character);
                db.SaveChanges();
            }
            else
            {
                throw new CharacterAlreadyAssignedException();
            }
        }
Example #23
0
        private void LoadButton_OnClick(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "XML File|*.xml";
            ofd.Title  = "Open Character";


            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var characterSheet = ofd.OpenFile();

                XmlSerializer mySerializer = new XmlSerializer(typeof(CharacterDetails));
                Character = (CharacterDetails)mySerializer.Deserialize(characterSheet);
            }
        }
Example #24
0
        public void AssociateCharacter(ApplicationUser user, CharacterDetails character)
        {
            IEnumerable <CharacterDetails> existingCharacters = _characterRepository.GetCharactersForUser(user);

            try
            {
                _characterRepository.AddCharacterToAccount(user, character);
                if (existingCharacters.Count() == 0)
                {
                    SetCharacterAsPrimary(user, character);
                }
            }
            catch (Data.Repositories.PSQL.Exceptions.CharacterAlreadyAssignedException ex)
            {
                throw new Exceptions.CharacterAlreadyAssignedException();
            }
        }
Example #25
0
    void UpdatePanel()
    {
        CharacterDetails detail = character.GetComponent <CharacterDetails>();

        health.text  = detail.Health() + "/" + detail.maxHealth;
        stamina.text = detail.Stam() + "/" + detail.maxStam;
        energy.text  = detail.Energy() + "/" + detail.maxEnergy;

        healthSlider.maxValue = detail.maxHealth;
        healthSlider.value    = detail.Health();

        stamSlider.maxValue = detail.maxStam;
        stamSlider.value    = detail.Stam();

        energySlider.maxValue = detail.maxEnergy;
        energySlider.value    = detail.Energy();
    }
Example #26
0
        public CharacterDetails GetCharacterDetailsFromToken(string token)
        {
            string url = $"{_eveSettings.SSO.LoginHost}/verify";

            HttpClient client = GetOAuthClient((AuthenticationType.Bearer, token));

            HttpResponseMessage response = client.GetAsync(url).Result;

            if (response.StatusCode == HttpStatusCode.OK)
            {
                string responseBody = response.Content.ReadAsStringAsync().Result;

                CharacterDetails character = JsonConvert.DeserializeObject <CharacterDetails>(responseBody);
                return(character);
            }

            return(null);
        }
Example #27
0
    public void Spawn()
    {
        content.sizeDelta = new Vector2((numberOfCharacters / 3) * 65, (numberOfCharacters / 3) * 65);

        for (int i = 0; i < numberOfCharacters; i++)
        {
            // 60 width of item
            float nextPosition = i * 65;

            Vector3 nextChar = new Vector3(nextPosition, -149, SpawnPoint.position.z);

            SpawnedCharacters[i] = Instantiate(characterBox, nextChar, SpawnPoint.rotation);
            SpawnedCharacters[i].transform.SetParent(SpawnPoint, false);

            characterDetails = SpawnedCharacters[i].GetComponent <CharacterDetails>();
            characterDetails.characterBox.sprite = box.sprite;
            characterDetails.character           = characters[i];
            characterDetails.pic.sprite          = characters[i].characterHeadshot;
        }
    }
Example #28
0
        public IActionResult AssociateCode(string code)
        {
            CharacterDetails character = _oauthManager.GetCharacterDetailsFromCode(code);

            string errorMessage = string.Empty;

            try
            {
                _profileManager.AssociateCharacter(User, character);
            }
            catch (CharacterAlreadyAssignedException ex)
            {
                errorMessage = "Character already assigned to an account";
            }
            catch (Exception ex)
            {
                errorMessage = "An error occured. Please try again.";
            }

            return(RedirectToAction("Index", new { errorMessage }));
        }
Example #29
0
 /// <summary>
 /// Constructs a save with some default parameters.
 /// </summary>
 public Save()
 {
     Details       = new CharacterDetails();
     Proficiencies = new CharacterProficiencies();
     Skills        = new CharacterSkills();
     Ammo          = new Dictionary <AmmoType, AmmoPool>();
     foreach (var pair in AmmoPool.AmmoDefinitions)
     {
         Ammo.Add(pair.Value, new AmmoPool());
     }
     Items             = new List <Item>();
     Weapons           = new List <Weapon>();
     StatTable         = new StatsTable();
     LocationsVisited  = new HashSet <Location>();
     CurrentLocation   = Location.Fyrestone;
     Playthroughs      = new List <Playthrough>();
     UnknownVariable15 = new List <Int32>();
     UnknownVariable16 = new List <Int32>();
     EchoPlaythroughs  = new List <EchoPlaythrough>();
     UnknownVariable17 = new byte[0];
 }
        public ActionResult <string> Post([FromBody] CharacterDetails newCharacter)
        {
            try
            {
                using (var context = new CharacterManagementDBContext())
                {
                    context.CharacterDetails.Add(newCharacter);
                    context.SaveChanges();
                }
            }
            catch (DbUpdateException)
            {
                return("Character could not be added to the database. Please try again.");
            }
            catch (Exception)
            {
                return("Character addition failed.");
            }

            return($"{newCharacter.CharacterName} added successfully!");
        }
Example #31
0
    private void ActivateSelectedItem(CharacterDetails character)
    {
        if (_selectedItem.Activate(character))
        {
            GD.Print($"{_selectedItem.Name} used successfully on {character.Name}");

            _inventory.Items[_selectedItem]--;
            if (_inventory.Items[_selectedItem] == 0)
            {
                _inventory.Items.Remove(_selectedItem);
                _selectedItem   = null;
                _selectedItemId = _selectedItemId == 0 ? 0 : _selectedItemId - 1;
            }

            _itemsList.PopulateItems(_selectedItemId);
        }
        else
        {
            GD.Print($"{_selectedItem.Name} could not be used on {character.Name}");
        }
    }
Example #32
0
    // Use this for initialization
    void Start()
    {
        GameObject.Find("SoundManager").GetComponent <SoundManager>().playMainTheme();

        playerDetails = new CharacterDetails(this.GetComponent <NavMeshAgent>(), this.GetComponentInChildren <AttackHitboxLogic>(),
                                             this.GetComponentInChildren <RangedAttackLogic>(), this.GetComponentInChildren <StungunLogic>(),
                                             this.GetComponent <Hitpoints>(), this.GetComponent <BatteryCharge>(), null,
                                             this.GetComponent <PersonalSoundManager>(), sfxDict);

        aiDetails = new CharacterDetails(GameObject.Find("pai").GetComponent <NavMeshAgent>(),
                                         null, null, null, null, this.GetComponent <BatteryCharge>(),
                                         GameObject.Find("pai").GetComponent <CubeSpawnDespawner>(),
                                         GameObject.Find("pai").GetComponent <PersonalSoundManager>(), sfxDict);

        playerDetails.animator = this.GetComponentInChildren <Animator>();
        aiDetails.animator     = GameObject.Find("pai").GetComponentInChildren <Animator>();

        GameManager.playerDetails = playerDetails;
        GameManager.aiDetails     = aiDetails;
        currentState = new DefaultState(playerDetails);
    }
        public bool UpdateCharacter(CharacterDetails model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity = ctx.Characters.Single(e => e.CharacterID == model.CharacterID && e.OwnerID == _userID);

                var characterAbilities = GenerateCharacterAbilities(model.CharacterClass, model.CharacterRace);
                var characterLevel     = GetLevelFromXP(model.CharacterClass, model.CharacterXP);
                var attackBonus        = GetAttackBonus(model.CharacterClass, Convert.ToInt32(characterLevel));
                var averageHP          = GetAverageHitPoints(model.CharacterClass, model.CharacterRace, Convert.ToInt32(model.CharacterLevel));
                var xpDifference       = Convert.ToInt32(model.CharacterXP - entity.CharacterXP);

                if (model.CharacterRace == CharacterRace.Human)
                {
                    xpDifference = Convert.ToInt32(xpDifference * 1.1);
                }


                entity.CharacterName        = model.CharacterName;
                entity.CharacterStr         = model.CharacterStr;
                entity.CharacterDex         = model.CharacterDex;
                entity.CharacterCon         = model.CharacterCon;
                entity.CharacterInt         = model.CharacterInt;
                entity.CharacterWis         = model.CharacterWis;
                entity.CharacterCha         = model.CharacterCha;
                entity.CharacterRace        = model.CharacterRace;
                entity.CharacterClass       = model.CharacterClass;
                entity.CharacterAbilities   = characterAbilities;
                entity.CharacterXP          = entity.CharacterXP + xpDifference;
                entity.CharacterLevel       = characterLevel;
                entity.CharacterAC          = model.CharacterAC;
                entity.CharacterHP          = model.CharacterHP;
                entity.CharacterAttackBonus = Convert.ToInt32(attackBonus);
                entity.CharacterNotes       = model.CharacterNotes;

                return(ctx.SaveChanges() == 1);
            }
        }
Example #34
0
    public ICharacterHandler BuildCharacters(CharacterDetails details)
    {
        return(details switch
        {
            WarriorCharacter warrior => new CharacterHandler(
                "Warrior",
                _mediator,
                Random.Shared.Next(180, 240),
                new Sword(warrior.Strength),
                new Voice(1)),

            WizardCharacter wizard => new CharacterHandler(
                "Wizard",
                _mediator,
                Random.Shared.Next(80, 120),
                new Melee(5),
                Random.Shared.Next(1, 4) switch
            {
                1 => new Staff(wizard.SpellPower),
                2 => new Fan(wizard.SpellPower),
                3 => new Rod(wizard.SpellPower),
                _ => throw new InvalidOperationException()
            }),
Example #35
0
    internal float AnimationSpeed = 1.0f;                                //How fast the animations should play.
    #endregion

    void Awake()
    {
        //Cache our frequent lookups.
        Transform = GetComponent<Transform>();
        Self = gameObject;

        //Get our basic components.
        Animation = GetComponent<Animation>();
        NavAgent = GetComponent<NavMeshAgent>();
        ViewController = GetComponent<HeadLookController>();
        CharDetails = GetComponent<CharacterDetails>();

        NavAgent.enabled = false;   //We disable the nav agent, so that we can move the Agent to its starting position (Moving with NavAgent enabled causes path finding and we simply want to "place" them at the start.) 
   
        if(!StaticDemo)
            Transform.position = BedTarget.position;    //Place the agent at the start.

        MoveDirection = Transform.TransformDirection(Vector3.forward);  //Get their initial facing direction.

        //Add the basic animation info.
        AnimationKeys = new Dictionary<string, string>();
        AnimationKeys.Add("run", "VB_Run");
        AnimationKeys.Add("walk", "VB_Walk");
        AnimationKeys.Add("idle", "VB_Idle");
        AnimationKeys.Add("greet", "VB_Greeting");
        AnimationKeys.Add("talk", "VB_Talk");

        Inventory = new AgentInventory(this);
    }
Example #36
0
    public int AddAgent(CharacterDetails agent)
	{
		agents.Add(agent);
		return agents.size - 1;
	}
Example #37
0
    public void UpdateTarget(CharacterDetails newTarget)
    {
        enabled = true;

        if (newTarget == TargetDetails)
            return;

        TargetDetails = newTarget;
        effectLerp = 0.0f;

        if (OwnerMind.MemoryGraph.GetCueOpinion(TargetDetails.CharCue) < 0.0f)
            flipDirection = true;
        else
            flipDirection = false;
    }