Exemple #1
0
    void castSpell(int spellID, Vector3 startPos, Vector3 targetPos, int ownerID, int InstantiateID, PhotonMessageInfo info)
    {
        double timestamp = info.timestamp;
        bool   isUtility = m_spellData[spellID].isUtility();

        if (isAOE[spellID])
        {
            GameObject go        = (GameObject)Instantiate(Spell[spellID], targetPos, Quaternion.identity);
            SpellData  spellData = go.GetComponent <SpellData>();
            audio.PlayOneShot(spellData.CastSound());
            spellData.setOwnerID(ownerID);
            spellData.setOwner(this);
            spellData.setSpellID(spellID);
        }
        else if (isUtility)
        {
            GameObject go        = (GameObject)Instantiate(Spell[spellID], transform.position, Quaternion.identity);
            SpellData  spellData = go.GetComponent <SpellData>();
            audio.PlayOneShot(spellData.CastSound());
            spellData.setOwnerID(ownerID);
            spellData.setOwner(this);
        }
        else
        {
            CreateProjectile(startPos, targetPos, timestamp, ownerID, spellID, InstantiateID);
        }
    }
Exemple #2
0
    public void CreateProjectile(Vector3 startPos, Vector3 targetPos, double createTime, int ownerID, int spellID, int instantiateID)
    {
        GameObject go        = (GameObject)Instantiate(Spell[spellID], startPos, Quaternion.identity);
        SpellData  spellData = go.GetComponent <SpellData>();

        audio.PlayOneShot(spellData.CastSound());
        SpellMovement projectileMovement = go.GetComponent <SpellMovement>();

        spellData.setOwnerID(ownerID);
        if (ownerID == GetComponent <CharacterManager_NET>().playerID)
        {
            spellData.setOwner(this);
        }
        spellData.setInstantiateID(instantiateID);
        projectileMovement.SetCreationTime(createTime);
        projectileMovement.SetStartPosition(startPos);
        projectileMovement.SetSpellDirection(startPos, targetPos);
        m_sceneAbilities.Add(spellData);
    }