コード例 #1
0
ファイル: Character.cs プロジェクト: riftgarret/alphac
    protected Character(CharacterSO other)
    {
        // name
        displayName = other.displayName;

        // stats
        attributes = other.attributes;
        elementAttack = other.elementAttack;
        elementDefense = other.elementDefense;
        combatStats = other.combatStats;

        // level and class
        level = other.level;
        charClass = other.charClass;

        // create armor and weapon configs from class rules
        mWeaponConfig = charClass.CreateWeaponConfig();
        mArmorConfig = charClass.CreateArmorConfig();

        for (int i=0; i < other.weapons.Length; i++) {
            mWeaponConfig.EquipWeapon(other.weapons[i], i);
        }

        // TODO, this should be tightly coupled with SO implementation
        //		for (int i=0; i < other.weapons.Length; i++) {
        //			mArmorConfig.EquipArmor(other.armors[i], i);
        //		}

        curHP = maxHP;
    }
コード例 #2
0
 public Battler(CharacterSO character, int team, int index, Battle battle)
 {
     this.character = character;
     this.team      = team;
     this.index     = index;
     this.battle    = battle;
 }
コード例 #3
0
    public void SelectedFoe(int level)
    {
        switch (level)
        {
        case 0: enemyInfo = Foes.entitys[0];  break;

        case 1: enemyInfo = Foes.entitys[1]; break;

        case 2: enemyInfo = Foes.entitys[2]; break;

        case 3: enemyInfo = Foes.entitys[3]; break;

        case 4: enemyInfo = Foes.entitys[4]; break;

        case 5: enemyInfo = Foes.entitys[5]; break;

        case 6: enemyInfo = Foes.entitys[6]; break;

        case 7: enemyInfo = Foes.entitys[7]; break;

        case 8: enemyInfo = Foes.entitys[8]; break;

        case 9: enemyInfo = Foes.entitys[9]; break;

        case 10: enemyInfo = Foes.entitys[10]; break;

        case 11: enemyInfo = Foes.entitys[11]; break;
        }
    }
コード例 #4
0
 public Battler(CharacterSO character, int team, int index, Battle battle, Vector2Int pos)
 {
     this.character = character;
     this.team      = team;
     this.index     = index;
     this.battle    = battle;
     this.position  = pos;
 }
コード例 #5
0
 public void SetDialogue(IDialogueLine dialogueLine, CharacterSO character)
 {
     // TODO see class LocalizeStringEvent for the reference variables
     sentence.StringReference = dialogueLine.Sentence;
     // User can optionally show the name of the character.
     if (character)
     {
         actorName.StringReference = character.CharacterName;
     }
 }
コード例 #6
0
    public void PlayerCharacter(int choice)
    {
        switch (choice)
        {
        case 0: playerInfo = playerCharacters.entitys[0]; break;

        case 1: playerInfo = playerCharacters.entitys[1]; break;

        case 2: playerInfo = playerCharacters.entitys[2]; break;
        }
    }
コード例 #7
0
    private void Awake()
    {
        playerInfo      = PullPush.player;
        playerSelection = PullPush.playerCharacter;

        afterFightButton.interactable  = false;
        playerDeathButton.interactable = false;
        demonkidBeaten.interactable    = false;
        battle           = battleState.talking;
        timeBetweenTurns = attackTime.floatingPoint;
        SelectedFoe(enemyLevel.number);
        PlayerCharacter(playerSelection.number);
    }
コード例 #8
0
    void ApplySplash(CharacterSO character)
    {
        var ind = characters.IndexOf(character);

        if (ind != -1)
        {
            splashArtHolder.GetChild(ind).GetComponent <UnityEngine.UI.Image>().color = Color.white;
            return;
        }
        characters.Add(character);
        var go = new GameObject("Splash");

        go.transform.SetParent(splashArtHolder, false);
        var image = go.AddComponent <UnityEngine.UI.Image>();

        image.sprite = character.SplashArt;
        image.color  = Color.white;
        image.SetNativeSize();
    }
コード例 #9
0
    void ApplyCharacter(CharacterSO character)
    {
        foreach (var image in splashArtHolder.GetComponentsInChildren <UnityEngine.UI.Image>())
        {
            image.color = new Color(0.3f, 0.3f, 0.3f);
        }
        ApplySplash(character);

        string expressionName = currConv.Conversation[speechIndex].expression;         //VARLER

        if (expressionName == "Base")
        {
            portrait.sprite = character.PortraitArtBase;
        }
        else if (expressionName == "Happy")
        {
            portrait.sprite = character.PortraitArtHappy;
        }
        else if (expressionName == "Sad")
        {
            portrait.sprite = character.PortraitArtSad;
        }
        else if (expressionName == "Embarrassed")
        {
            portrait.sprite = character.PortraitArtEmbarrassed;
        }
        else if (expressionName == "Angry")
        {
            portrait.sprite = character.PortraitArtAngry;
        }
        else if (expressionName == "Perplexed")
        {
            portrait.sprite = character.PortraitArtPerplexed;
        }
        else
        {
            Debug.LogError("MISSING PORTRAIT!");
        }        //Varler: there's gotta be a better way of doing this. But this works.
    }
コード例 #10
0
    public override void OnInspectorGUI()
    {
        CharacterSO myTarget = (CharacterSO)target;

        base.OnInspectorGUI();

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Properties", EditorStyles.boldLabel);
        EditorGUI.indentLevel++;
        EditorGUILayout.LabelField("Hitpoints: " + myTarget.Hitpoints);
        EditorGUILayout.LabelField("Encumbrance: " + myTarget.Encumbrance);
        EditorGUILayout.LabelField("Free Encumbrance: " + myTarget.FreeEncumbrance);
        EditorGUILayout.LabelField("Armor: " + myTarget.Armor);
        EditorGUILayout.LabelField("Weapon Base Damage: " + myTarget.WeaponBaseDamage);
        EditorGUILayout.LabelField("Base Accuracy: " + myTarget.BaseAccuracy);
        EditorGUILayout.LabelField("Evasion: " + myTarget.BaseEvasion);

        if (GUILayout.Button("Refresh"))
        {
            myTarget.Refresh();
        }
    }
コード例 #11
0
ファイル: UIManager.cs プロジェクト: vamidi/StoryTime-UPM
 public void OpenUIDialogue(IDialogueLine dialogueLine, CharacterSO character)
 {
     dialogueController.SetDialogue(dialogueLine, character);
     dialogueController.gameObject.SetActive(true);
 }
コード例 #12
0
ファイル: Character.cs プロジェクト: riftgarret/alphac
 // used for cloning
 public static Character CreateFromConfig(CharacterSO config)
 {
     if(config is EnemyCharacterSO) {
         return new EnemyCharacter((EnemyCharacterSO)config);
     }
     else {
         return new PCCharacter((PCCharacterSO)config);
     }
 }
コード例 #13
0
    public ActionPreOutcome ResolveAction(BattlerAction action)
    {
        ActionPreOutcome outcome;

        CharacterSO    actor      = actors[action.actorIndex].character;
        CharacterSO    target     = actors[action.targetIndex].character;
        List <Battler> tempActors = new List <Battler>();

        foreach (Battler b in tempActors)
        {
            tempActors.Add(new Battler(b.character, b.team, b.index, this, b.position));
        }

        // Damage & Cost
        int cost = 2;

        cost += action.skill.extraCost;
        // cost += distance, if melee
        cost += Mathf.Min(Distance(action.actorIndex, action.targetIndex) - actor.weapon.weapon.range, 0); // TODO: consider path blocking
        int damage = 0;

        damage += action.skill.extraDamage;
        switch (action.skill.baseDamage)
        {
        case Skill.BaseDamage.STRENGTH:
            damage += actor.character.attributes.strength;
            damage += actor.weapon.weapon.value;
            damage -= target.Armor;     // .armor.armor.value;
            cost   += actor.weapon.weapon.weight;
            break;

        case Skill.BaseDamage.FREE_ENCUMBRANCE:
            damage += actor.character.attributes.strength - actor.Encumbrance;
            damage += actor.weapon.weapon.value;
            damage -= target.Armor;     // .armor.armor.value;
            cost   += actor.weapon.weapon.weight;
            break;

        case Skill.BaseDamage.INTELLIGENCE:
            damage += actor.character.attributes.inteligence;
            damage -= target.character.attributes.inteligence;
            cost   += 3 - Mathf.FloorToInt(actor.FreeEncumbrance / 2);
            break;
        }

        // To Hit Chance
        int toHitChance   = 6;
        int targetEvasion = target.character.attributes.dexterity + Mathf.FloorToInt(target.FreeEncumbrance / 2);

        //targetEvasion += target.shield.shield.value * (actors[action.targetIndex].defending ? 2 : 1); //FIXME: characterSO must handle null values for equipment
        switch (action.skill.type)
        {
        case Skill.Type.MELEE:
            toHitChance += actor.character.attributes.dexterity + Mathf.FloorToInt(actor.FreeEncumbrance / 2);
            toHitChance -= targetEvasion;
            break;

        case Skill.Type.PROJECTILE:
            toHitChance += actor.character.attributes.dexterity + Mathf.FloorToInt(actor.FreeEncumbrance / 2);
            toHitChance -= targetEvasion;
            break;

        case Skill.Type.DIRECT:
            break;
        }
        if (toHitChance < 1)
        {
            toHitChance = 1;
        }

        outcome.cost        = cost;
        outcome.toHitChance = toHitChance;
        outcome.damage      = damage;

        return(outcome);
    }