public void SpawnSpell(GameObject target)
    {
        Vector3 spellPosition = new Vector3(target.transform.position.x, spellPrefab.transform.position.y, target.transform.position.z);

        GameObject minionEffects = SC_Helper.FindChildWithTag(target, "Minion Effects");

        // Set the position and parent of the spell
        GameObject spell = GameObject.Instantiate(spellPrefab);

        spell.transform.position = spellPosition;
        spell.transform.parent   = minionEffects.transform;
    }
Пример #2
0
    void OnMouseExit()
    {
        if (isTargetable)
        {
            Cursor.SetCursor(null, Vector2.zero, cursorMode);

            // Selection Ring
            if (gameObject.tag == "Ally")
            {
                SC_Helper.FindChildWithTag(gameObject, "Selection Ring Green").SetActive(false);
            }
            else if (gameObject.tag == "Enemy")
            {
                SC_Helper.FindChildWithTag(gameObject, "Selection Ring Red").SetActive(false);
            }
        }
    }
Пример #3
0
    void OnMouseEnter()
    {
        if (isTargetable)
        {
            Cursor.SetCursor(cursorTexture, hotSpot, cursorMode);

            // Selection Ring
            if (gameObject.tag == "Ally")
            {
                SC_Helper.FindChildWithTag(gameObject, "Selection Ring Green").SetActive(true);
            }
            else if (gameObject.tag == "Enemy")
            {
                SC_Helper.FindChildWithTag(gameObject, "Selection Ring Red").SetActive(true);
            }
        }
    }
Пример #4
0
    private IEnumerator MassTeleportation(GameObject target)
    {
        isTeleporting = true;
        teleporters   = new List <GameObject>();

        // Set the target
        this.target = target;

        // Add player to the teleporters list
        teleporters.Add(player);

        // Stop player movement
        player.GetComponent <NavMeshAgent> ().Stop();

        /* 1st Teleport Sequence
         **********************/
        GameObject spell         = GameObject.Instantiate(spellPrefab);
        Vector3    spellPosition = new Vector3(player.transform.position.x, spellPrefab.transform.position.y, player.transform.position.z);

        spell.transform.position = spellPosition;
        spell.transform.parent   = player.transform;

        // Collider checks for allys in range to be teleported
        SphereCollider teleportCollider = gameObject.AddComponent <SphereCollider>();

        teleportCollider.isTrigger = true;
        teleportCollider.radius    = teleportRadius;

        /* 2nd Teleport Sequence
         **********************/

        // Stop target movement
        target.GetComponent <SC_RandomMovement> ().isMoving = false;

        GameObject targetSpell         = GameObject.Instantiate(targetSpellPrefab);
        Vector3    targetSpellPosition = new Vector3(target.transform.position.x, targetSpellPrefab.transform.position.y, target.transform.position.z);

        targetSpell.transform.position = targetSpellPosition;
        targetSpell.transform.parent   = SC_Helper.FindChildWithTag(target, "Minion Effects").transform;

        yield return(new WaitForSeconds(teleportWaitDuration));

        /* 3rd Teleport Sequence
         **********************/

        for (int i = 0; i < teleporters.Count; i++)
        {
            GameObject teleporter = teleporters[i];

            Vector3    teleporterFromLocation = new Vector3(teleporter.transform.position.x, teleporterSpellPrefab.transform.position.y, teleporter.transform.position.z);
            GameObject teleporterFrom         = GameObject.Instantiate(teleporterSpellPrefab);
            teleporterFrom.transform.position = teleporterFromLocation;
        }

        // Mini-wait before position change
        yield return(new WaitForSeconds(0.5f));

        /* 4th Teleport Sequence
         **********************/
        for (int i = 0; i < teleporters.Count; i++)
        {
            GameObject teleporter = teleporters[i];

            // Random teleport position within target range
            Vector3 teleporterInPosition = new Vector3(targetSpellPosition.x + Random.Range(-1.5f, 1.5f), teleporter.transform.position.y, targetSpellPosition.z + Random.Range(-1.0f, 1.0f));
            teleporter.transform.position = teleporterInPosition;

            GameObject teleporterIn = GameObject.Instantiate(teleporterSpellPrefab);
            teleporterIn.transform.position = new Vector3(teleporterInPosition.x, teleporterSpellPrefab.transform.position.y, teleporterInPosition.z);
            teleporterIn.transform.parent   = SC_Helper.FindChildWithTag(teleporter, "Minion Effects").transform;
        }

        // Finished teleporting
        player.GetComponent <NavMeshAgent> ().Stop();
        isTeleporting = false;
        teleporters   = new List <GameObject>();
        Destroy(gameObject.GetComponent <SphereCollider>());

        // Resume target movement
        target.GetComponent <SC_RandomMovement> ().isMoving = true;
    }