Ejemplo n.º 1
0
    private void SpawnSpider()
    {
        //Spawn enemy
        SpiderAIBehaviour spider;

        switch (colorMode)
        {
        case ColorMode.FIXED:
            spider = rsc.coloredObjectsMng.GetSpider(color, spawnPoint.position);
            break;

        case ColorMode.CURRENT:
            spider = rsc.coloredObjectsMng.GetSpider(colorOffset, spawnPoint.position);
            break;

        case ColorMode.RANDOM:
            spider = rsc.coloredObjectsMng.GetSpider(true, spawnPoint.position);
            break;

        default:
            spider = rsc.coloredObjectsMng.GetSpider(colorOffset, spawnPoint.position);
            break;
        }

        if (spider != null)
        {
            spider.AIInit(spawnAnimation, entryActions, attackActions, infectActions);
            spider.Spawn(spawnPoint);

            if (spawnAnimation == SpiderAIBehaviour.SpawnAnimation.FLOOR)
            {
                spawnController.CreatePortal(spider.color);
            }
        }
    }
    private void SpawnSpider()
    {
        SpiderAIBehaviour spider;

        int color = colors[spiderIndex];

        //-4 to -1 (current color plus optional offset)
        if (color >= ChromaColorInfo.CURRENT_COLOR_OFFSET && color <= ChromaColorInfo.CURRENT_COLOR_PLUS3_OFFSET)
        {
            spider = rsc.coloredObjectsMng.GetSpider(color, spawnPoint.position);
        }
        //first chroma color to last chroma color (fixed color)
        else if (color >= (int)ChromaColorInfo.First && color <= (int)ChromaColorInfo.Last)
        {
            spider = rsc.coloredObjectsMng.GetSpider((ChromaColor)color, spawnPoint.position);
        }
        //any other number will be handled as offset
        else
        {
            color  = color % ChromaColorInfo.Count;
            spider = rsc.coloredObjectsMng.GetSpider(color, spawnPoint.position);
        }

        if (spider != null)
        {
            spider.AIInitGroup(spawnAnimation, groupInfo, leaderActions, followersActions[spiderIndex], attackActions, infectActions, (spiderIndex == 0) ? true : false);
            spider.Spawn(spawnPoint);

            if (spawnAnimation == SpiderAIBehaviour.SpawnAnimation.FLOOR)
            {
                spawnController.CreatePortal(spider.color);
            }
        }

        ++spiderIndex;
    }