Пример #1
0
    public GameObject GetSkillShotToPlay()
    {
        if (!GetComponent <Prisoner>())
        {
            print("The actor using this shooting skill script is not character player");
            return(null);
        }
        string charName          = GetComponent <Prisoner>().GetPrisonerName();
        string lastUsedSkillName = Prisoner.GetCharacterLastUsedSkill(charName);

        for (int i = 0; i < skillShotPrefabs.Length; i++)
        {
            if (skillShotPrefabs[i].GetComponent <CharacterSkillShot>())
            {
                if (skillShotPrefabs[i].GetComponent <CharacterSkillShot>().GetShotSkillName() == lastUsedSkillName)
                {
                    return(skillShotPrefabs[i]);
                }
            }
            else if (skillShotPrefabs[i].GetComponent <SupportSkillShot>())
            {
                if (skillShotPrefabs[i].GetComponent <SupportSkillShot>().GetShotSkillName() == lastUsedSkillName)
                {
                    return(skillShotPrefabs[i]);
                }
            }
        }

        return(null);
    }