private void RpcOtherStuff(GameObject spell, string smName)
    {
        NetSplashScript  script = spell.GetComponent <NetSplashScript>();
        SpellModificator sm     = gameObject.GetComponent <NetSpellCreating>().getModIfExists(smName);

        script.ApplyModificator(sm);
    }
 public void addModificator(SpellModificator sm)
 {
     modificators.Add(sm.Name, sm);
     if (modBookPanel != null)
     {
         modBookPanel.GetComponent <ModBookLogic>().addModBookEntry(sm.Name, sm);
     }
 }
Exemple #3
0
    public void addModBookEntry(string name, SpellModificator sm)
    {
        GameObject newEntry = Instantiate(templateEntry)  as GameObject;

        newEntry.GetComponent <SpellBookEntry>().setText(name);
        newEntry.GetComponent <SpellBookEntry>().setSprite(name);
        newEntry.transform.SetParent(gameObject.transform, false);
        entries.Add(name, newEntry);
    }
    private void RpcOtherStuff(GameObject spell, string smName)
    {
        NetHighVoltageLogic voltageLogic = spell.GetComponent <NetHighVoltageLogic>();

        voltageLogic.SetOwner(gameObject);

        SpellModificator sm = gameObject.GetComponent <NetSpellCreating>().getModIfExists(smName);

        voltageLogic.ApplyModificator(sm);
    }
Exemple #5
0
    private void RpcOtherStuff(GameObject spell, string smName)
    {
        NetPhantasmLogic spellComp = spell.GetComponent <NetPhantasmLogic>();

        spellComp.SetOwner(gameObject);

        SpellModificator sm = gameObject.GetComponent <NetSpellCreating>().getModIfExists(smName);

        spellComp.ApplyModificator(sm);
    }
Exemple #6
0
    public override void cast(string smName)
    {
        SpellModificator sm            = gameObject.GetComponent <SpellCreating> ().getModIfExists(smName);
        Vector3          spellSpawnPos = gameObject.transform.position + transform.forward;
        GameObject       voltage       = GameObject.Instantiate(highVoltage, spellSpawnPos, gameObject.transform.rotation);
        HighVoltageLogic voltageLogic  = voltage.GetComponent <HighVoltageLogic>();

        if (sm != null && sm is RepeatModificator)
        {
            float wait = ((RepeatModificator)sm).wait;
            StartCoroutine(repeatCast(wait, spellSpawnPos, gameObject.transform.rotation));
        }
        else
        {
            voltageLogic.ApplyModificator(sm);
        }
        voltageLogic.SetOwner(gameObject);
    }
    public void cast(string smName)
    {
        SpellModificator sm = gameObject.GetComponent <SpellCreating> ().getModIfExists(smName);

        splashCircleDrawer.CreatePoints(radius);

        bool    waterFound = false;
        Vector3 waterPos   = new Vector3();
        Vector3 waterDestination;

        Collider[] intersectObjs = Physics.OverlapSphere(transform.position, radius);
        foreach (var obj in intersectObjs)
        {
            if (obj.tag == "Water")
            {
                waterFound = true;
                waterPos   = obj.transform.position + new Vector3(0, 1.5f, 0);
                print("Water for splash casting found");
                break;
            }
        }

        if (waterFound)
        {
            RaycastHit hit;

            if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 100))
            {
                waterDestination = hit.point;
                Quaternion towaradsPoint = Quaternion.LookRotation(waterDestination - waterPos + new Vector3(0, 0.75f, 0));
                GameObject splash        = Instantiate(waterSplash, waterPos, towaradsPoint);
                if (sm != null && sm is RepeatModificator)
                {
                    float wait = ((RepeatModificator)sm).wait;
                    Instantiate(waterSplash, waterPos, towaradsPoint);
                    StartCoroutine(repeatCast(wait, waterPos, towaradsPoint));
                }
                else
                {
                    splash.GetComponent <SplashScript>().ApplyModificator(sm);
                }
            }
        }
    }
Exemple #8
0
    public override void cast(string smName)
    {
        SpellModificator sm = gameObject.GetComponent <SpellCreating> ().getModIfExists(smName);

        ownerTransform = this.gameObject.transform;
        Vector3 spellSpawnPosition = makeSpellSpawnPos(ownerTransform.forward * 2.0F, ownerTransform);

        spellSpawnPosition += new Vector3(0, 0.5f, 0);
        GameObject d = Instantiate(diamond, spellSpawnPosition, ownerTransform.rotation);

        if (sm != null && sm is RepeatModificator)
        {
            float wait = ((RepeatModificator)sm).wait;
            StartCoroutine(repeatCast(wait, spellSpawnPosition, ownerTransform.rotation));
        }
        else
        {
            d.GetComponent <DiamondLogic>().ApplyModificator(sm);
        }
    }
Exemple #9
0
    private List <GameObject> collidesWith = new List <GameObject>();   // Whom phantasm already collided with

    public void ApplyModificator(SpellModificator sm)
    {
        if (sm == null)
        {
            return;
        }
        if (sm is NetStrongModificator)
        {
            attackFactor = ((NetStrongModificator)sm).factor;
        }
        if (sm is NetGreatModificator)
        {
            float sF = ((NetGreatModificator)sm).scaleFactor;             // TODO: fix
            gameObject.transform.localScale += new Vector3(sF - 1.0f, 0, sF - 1.0f);
        }
        if (sm is NetQuickModificator)
        {
            NetQuickModificator qm = (NetQuickModificator)sm;
            attackFactor = 1 / qm.weakFactor;
            speedFactor  = qm.speedFactor;
        }
    }
 public void ApplyModificator(SpellModificator sm)
 {
     if (sm == null)
     {
         return;
     }
     appliedMod = sm;
     if (sm is StrongModificator)
     {
         attackFactor = ((StrongModificator)sm).factor;
     }
     if (sm is GreatModificator)
     {
         float sF = ((GreatModificator)sm).scaleFactor;
         gameObject.transform.localScale += new Vector3(sF - 1.0f, 0, sF - 1.0f);
     }
     if (sm is QuickModificator)
     {
         QuickModificator qm = (QuickModificator)sm;
         attackFactor = 1 / qm.weakFactor;
         speedFactor  = qm.speedFactor;
     }
 }
    public override void cast(string smName)
    {
        SpellModificator sm = gameObject.GetComponent <SpellCreating> ().getModIfExists(smName);
        RaycastHit       hit;

        if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 100))
        {
            Vector3       phantasmDestination = hit.point;
            Vector3       spellSpawnPos       = phantasmDestination + new Vector3(0, 1.0f, 0);
            GameObject    spell     = GameObject.Instantiate(phantasm, spellSpawnPos, gameObject.transform.rotation);
            PhantasmLogic spellComp = spell.GetComponent <PhantasmLogic>();
            if (sm != null && sm is RepeatModificator)
            {
                float wait = ((RepeatModificator)sm).wait;
                StartCoroutine(repeatCast(wait, spellSpawnPos, gameObject.transform.rotation));
            }
            else
            {
                spellComp.ApplyModificator(sm);
            }
            spellComp.SetOwner(gameObject);
        }
    }