Ejemplo n.º 1
0
    // private EnemyObject_Abstract burningEnemy;
    // private Vector3 burningLocation;
    // private bool anEnemyIsBurning = false;
    // private byte burnTimer_current = 0;
    // private const byte burnTimer_max = 6;
    // private const byte burnDamage = 3;



    public void placeStartingEnemies(Vector3 boatPos, bool[,] boolArray, DoorHitboxManager doorHitboxManager, byte areaWidth, byte areaHeight, PortTownReturnPacket portTownPacket, float frequencyOfEnemies)
    {
        this.boolArray         = boolArray;
        this.doorHitboxManager = doorHitboxManager;
        this.areaWidth         = areaWidth;
        this.areaHeight        = areaHeight;
        spawnRateMultiplier    = 100f / (areaWidth * areaHeight - 7);

        setSpawnFrequency(frequencyOfEnemies);


        numOfPortTowns    = portTownPacket.getNumofPortTowns_actual();
        portTownLocations = new Vector3[numOfPortTowns];

        for (byte index = 0; index < numOfPortTowns; index++)
        {
            portTownLocations[index] = portTownPacket.getPortTownLocation_asVector3(index);
        }


        if (shouldSpawnEnemies)
        {
            int numOfStartingEnemies = (int)(10 / spawnRateMultiplier);

            for (int index = 0; index < 3; index++)
            {
                attemptToSpawnRandomEnemy_2(boatPos);
            }
        }
    }
Ejemplo n.º 2
0
    private void placeAllPortTowns(PortTownReturnPacket portTownPacket)
    {
        GameObject tempBuilding;
        PortTownIndividualPacket portTownIndividual;
        int     numOfHouses;
        Color32 tempRoofColor;
        Color32 tempWallColor;

        // int brightnessOffset;

        for (byte index1 = 0; index1 < portTownPacket.getNumofPortTowns_actual(); index1++)
        {
            // Place the pier:
            tempBuilding = Instantiate(prefab_portTownPier, portTownPacket.getPortTownLocation_asVector3(index1), Quaternion.identity);
            tempBuilding.transform.eulerAngles = portTownPacket.getPortTownRotation_asVector3(index1);

            interactablesManager.addObjectToArray(tempBuilding, Constants.interactableID_portTownPier, 0);

            // Now place all the houses:
            portTownIndividual = portTownPacket.getPortTownArray()[index1];
            numOfHouses        = portTownIndividual.getHouseLocations().Length;

            for (byte index2 = 0; index2 < numOfHouses; index2++)
            {
                tempBuilding = Instantiate(prefab_portTownHouse, portTownIndividual.getHouseLocations()[index2], Quaternion.identity);
                tempBuilding.transform.eulerAngles = portTownIndividual.getHouseRotation_asVector3(index2);
                tempBuilding.transform.localScale  = portTownIndividual.getHouseScales()[index2];

                tempRoofColor = portTownIndividual.getHouseRoofColors()[index2];
                tempWallColor = portTownIndividual.getHouseWallColors()[index2];

                setHouseColors(tempRoofColor, tempWallColor, tempBuilding.GetComponent <MeshRenderer>().material);
            }
        }
    }