コード例 #1
0
    public void BuildCheatCompanionSet()
    {
        Game.instance.playerData.followerUid = null;

        List <Quirk> quirks = QuirksInLevel(90, -1, 90, -1);
        List <Spell> spells = SpellsInLevel(90, -1, 90, -1);

        int numCharacters = Mathf.Max(quirks.Count, spells.Count);

        CharacterData[] characters = new CharacterData[numCharacters];
        for (int i = 0; i < numCharacters; ++i)
        {
            Spell spell = spells[i % spells.Count];
            Quirk quirk = quirks[i % quirks.Count];

            CharacterData character = Game.instance.companionBuilder.BuildRandomCharacter(quirk, spell);
            characters[i] = character;
        }

        Game.instance.characterDataList.characterData = characters;

        Follower currentFollower = GameObject.FindObjectOfType <Follower>();

        if (currentFollower != null)
        {
            currentFollower.GetComponentInChildren <CharacterModel>().RemoveModel();
        }
    }
コード例 #2
0
ファイル: LevelGenerator.cs プロジェクト: bdsowers/cutiequest
    private void PlaceAvatar()
    {
        GameObject avatar = GameObject.Find("Avatar");

        avatar.transform.SetParent(transform);

        Vector2Int pos           = mDungeon.primaryPathPositions[0];
        Vector2Int guaranteedPos = mDungeon.PositionForSpecificTile('p');

        if (guaranteedPos.x != -1 && guaranteedPos.y != -1)
        {
            pos = guaranteedPos;
        }

        pos = FindEmptyNearbyPosition(pos);
        mAvatarStartPosition = pos;

        mCollisionMap.MarkSpace(pos.x, pos.y, avatar.GetComponent <SimpleMovement>().uniqueCollisionIdentity);
        avatar.transform.position = MapCoordinateHelper.MapToWorldCoords(pos);

        // Also place any followers/pets adjacent to the player
        Follower follower   = avatar.GetComponent <PlayerController>().follower;
        string   followerId = Game.instance.playerData.followerUid;

        if (string.IsNullOrEmpty(followerId))
        {
            followerId = "1";
        }
        CharacterData followerData = Game.instance.followerData;

        follower.GetComponentInChildren <CharacterModel>().ChangeModel(followerData);

        pos = FindEmptyNearbyPosition(pos);
        follower.transform.position = MapCoordinateHelper.MapToWorldCoords(pos);

        avatar.GetComponent <Killable>().allowZeroDamage = (CurrentDungeonFloorData().roomSet == "introdungeon");

        avatar.GetComponent <PlayerController>().PlaceFollowerInCorrectPosition();
    }
コード例 #3
0
    public void BuildCompanionSet()
    {
        Game.instance.playerData.followerUid = null;

        int numCharacters = Random.Range(3, 6);

        CharacterData[] characters = new CharacterData[numCharacters];
        for (int i = 0; i < numCharacters; ++i)
        {
            CharacterData character = Game.instance.companionBuilder.BuildRandomCharacter();
            characters[i] = character;
        }

        Game.instance.characterDataList.characterData = characters;

        Follower currentFollower = GameObject.FindObjectOfType <Follower>();

        if (currentFollower != null)
        {
            currentFollower.GetComponentInChildren <CharacterModel>().RemoveModel();
        }
    }
コード例 #4
0
    private void CastSpellIfPossible()
    {
        if (!Game.instance.InDungeon())
        {
            return;
        }

        Spell spell = GetComponentInChildren <Spell>();

        if (spell != null && spell.canActivate)
        {
            spell.Activate(gameObject);
        }

        if (HasFollower())
        {
            spell = follower.GetComponentInChildren <Spell>();
            if (spell != null && spell.canActivate)
            {
                spell.Activate(gameObject);
            }
        }
    }