예제 #1
0
    /////////////////////////////////////////////////////
    //Initialization

    // enum converters
    GameObject typeToTurret(turretType type)
    {
        switch ((int)type)
        {
        case 0: return(basicTurret);

        case 1: return(bashTurret);

        case 2: return(slowTurret);

        case 3: return(burnTurret);

        case 4: return(snipeTurret);

        default: break;
        }
        return(basicTurret);
    }
예제 #2
0
    int typeToTurretCost(turretType type)
    {
        switch ((int)type)
        {
        case 0: return(1);

        case 1: return(10);

        case 2: return(3);

        case 3: return(3);

        case 4: return(10);

        default: break;
        }
        return(1);
    }
예제 #3
0
    float typeToInfluence(turretType type)
    {
        switch ((int)type)
        {
        case 0: return(1);

        case 1: return(10);

        case 2: return(3);

        case 3: return(3);

        case 4: return(10);

        default: break;
        }
        return(1);
    }
예제 #4
0
/*
 *      private int buildViewWidth;
 *      private int buildViewHeight;
 *      private int buildContentOffset;
 *      private int buildContentWidth;
 */

    //type conversion methods
    Texture typeToTurretImage(turretType type)
    {
        switch ((int)type)
        {
        case 0: return(basicTurretImage);

        case 1: return(bashTurretImage);

        case 2: return(slowTurretImage);

        case 3: return(burnTurretImage);

        case 4: return(snipeTurretImage);

        default: break;
        }
        return(basicTurretImage);
    }
예제 #5
0
    //initializers for objects
    //createss turret, and sets grid tile traversibility to false, updates influence map
    public void createTurret(Vector2 gridPos, turretType type)
    {
        GameObject newTurretType = typeToTurret(type);
        GameObject newTurret     = (GameObject)Instantiate(newTurretType, new Vector3(gridPos.x, 0.4f, gridPos.y), Quaternion.identity);

        newTurret.tag = "Turret";
        traversible[(int)gridPos.x, (int)gridPos.y] = false;
        availableUnits -= ((turret)newTurret.GetComponent("turret")).cost;
        applyToInfluenceMap(newTurret, true);
        ArrayList proposedPath = pm.updatePath(sm.spawnPos, goalPos);

        if (proposedPath != null)
        {
            currentPath = proposedPath;
        }
        else
        {
            destroyTurret(newTurret);
        }
        updatePathParticles();
        //newTurret.GetComponent("Creep").gm = this.GetComponent("Game Manager");
        //turrets.Add(newTurret);
    }