Example #1
0
    public void InstantiateBubbleWithTargets(string bubbleType, Vector2 initialPosition, Vector2[] targetPositions, float movementSpeed, float timeToWait, float timeToKillBubble)
    {
        GameObject bubble = (GameObject)Instantiate(Resources.Load("Prefabs/Bubbles/" + bubbleType));

        if (bubble)
        {
            if (bubbleType == "BurbujaN")
            {
                BubbleController bController = bubble.GetComponent <BubbleController>();
                bController.InitializeNeutralBubble(BubbleController.MoveType.Targets);
                bController.SetMovement(initialPosition, targetPositions, movementSpeed, timeToWait, timeToKillBubble);
            }
            else
            {
                GameObject       bubbleParticle = InstantiatePrefab("BubbleParticles/" + bubbleType, initialPosition);
                PlayerController powerCaster    = GetPowerableBubbleCaster(bubbleType);
                BubbleController bController    = bubble.GetComponent <BubbleController>();
                bController.InitializeColouredBubbles(BubbleController.MoveType.Targets, powerCaster, bubbleParticle);
                bController.SetMovement(initialPosition, targetPositions, movementSpeed, timeToWait, timeToKillBubble);
            }
        }
    }