Exemple #1
0
    //public Methods
    public SpellCastTransData GetProperCastTransData()
    {
        SpellCastTransData result = new SpellCastTransData();

        Bone b = _skeletonAnim.skeleton.FindBone(_bone_SpellCastHelper01);

        Vector3 resPos = Vector3.zero;

        if (_type == HelperPointType.PivotPoint)
        {
            resPos = _skeletonAnim.transform.TransformPoint(b.WorldX, b.WorldY, 0);
        }
        else
        {
            Bone b2 = _skeletonAnim.skeleton.FindBone(_bone_SpellCastHelper02);

            Vector3 startP = _skeletonAnim.transform.TransformPoint(b.WorldX, b.WorldY, 0);
            Vector3 endP   = _skeletonAnim.transform.TransformPoint(b2.WorldX, b2.WorldY, 0);

            resPos = (startP + endP) / 2;
        }

        result.position       = resPos;
        result.rotationAmount = 180 - b.WorldRotationX;

        return(result);
    }
Exemple #2
0
    public static Spell Build(SpellInfo spellInfo, SpellCastTransData transData)
    {
        Spell spell = GameObject.Instantiate(spellInfo.GetSpellPrefab()).GetComponent <Spell>();

        spell.transform.position   = transData.position;
        spell.transform.localScale = transData.scale;
        spell.Init(spellInfo);
        return(spell);
    }
    private SpellCastTransData FindProperCastingPos_ChakraFereydoun(Character target)
    {
        SpellCastTransData stData = new SpellCastTransData();

        stData.position       = new Vector3(target.position_pivot.x, target.position_pivot.y, target.position_pivot.z);
        stData.rotationAmount = 0f;
        stData.scale          = target.scale;

        return(stData);
    }
    private SpellCastTransData FindProperCastingPos_Wizard(Character target)
    {
        SpellCastTransData stData = new SpellCastTransData();

        stData.position       = new Vector3(target.position_pivot.x, OverScreen() * 1.2f, target.position_pivot.z);
        stData.rotationAmount = 0f;
        stData.scale          = target.scale;

        return(stData);
    }
    //Private Methods
    private SpellCastTransData FindProperCastingPos_Archer(Character target)
    {
        SpellCastTransData stData = new SpellCastTransData();

        stData.position       = new Vector3(0f, OverScreen() + 2.5f, 0f);
        stData.rotationAmount = 0f;
        stData.scale          = target.scale;

        return(stData);
    }
    private void MakeSpell()
    {
        List <SpellEffectInfo> spEfInf = new List <SpellEffectInfo>();

        int currentIndex = _indexesOfDamagedSpells[_numOfCreatedSpells];

        if (_numOfCreatedSpells + 1 == _indexesOfDamagedSpells.Count)
        {
            for (int i = _numOfCreatedSpells; i < _spellInfo.spellEffectInfos.Count; i++)
            {
                spEfInf.Add(_spellInfo.spellEffectInfos[i]); //Because now all other effects are sequential
            }
        }
        else
        {
            spEfInf.Add(_spellInfo.spellEffectInfos[currentIndex]);
        }

        SpellInfo spIn = new SpellInfo(
            _spellInfo.charSpellsIndex,
            _spellInfo.isInstant,
            _spellInfo.dontShowToUser,
            _spellInfo.needTargetToComeNear,
            _spellInfo.spellName,
            _spellInfo.cost,
            _spell.name,
            _spellInfo.spellType,
            _spellInfo.damageType,
            _spellInfo.spellImpact,
            spEfInf
            );
        spIn.owner = _spellInfo.owner;

        SpellCastTransData transData = new SpellCastTransData();

        SpellCastHelper_MultiSpell helper_multiCast = gameObject.GetComponent <SpellCastHelper_MultiSpell>();
        if (helper_multiCast != null)
        {
            transData = helper_multiCast.FindProperCastingPos(spIn.owner,
                                                              _spellInfo.spellEffectInfos[currentIndex].targetCharacter);
        }
        else
        {
            transData.position       = transform.position;
            transData.rotationAmount = 0;
            transData.scale          = transform.localScale;
        }

        Spell temp = SpellBuilder.Build(spIn, transData);
        temp.Event_SpellWillDestroy += OnSpellDestroy;
        _createdSpells.Add(temp);

        _numOfCreatedSpells++;
    }
Exemple #7
0
    public SpellCastTransData GetSpellTransData()
    {
        SpellCastHelper    spellCastHelper = GetComponent <SpellCastHelper>();
        SpellCastTransData stData          = new SpellCastTransData();

        if (spellCastHelper == null)
        {
            stData.position       = Vector3.zero;
            stData.rotationAmount = 0;
        }
        else
        {
            stData = spellCastHelper.GetProperCastTransData();
        }

        stData.scale = transform.localScale * _scaleFactor;

        return(stData);
    }