コード例 #1
0
ファイル: PlayerStats.cs プロジェクト: nthieucz/DaddyLoad
    private void FixedUpdate()
    {
        if (pressure > maxPressureThreshold ^ pressure < minPressureThreshold)
        {
            //any damage function
            setHP(HP - 1);
        }

        if (temperature > maxTemperatureThreshold ^ temperature < minTemperatureThreshold)
        {
            //any damage function
            setHP(HP - 1);
        }

        /*
         * //toggle radiation DPS
         * if (Input.GetKey("r"))
         * {
         *  setRadiation(radiation + 1);
         * }
         */

        //Temperature setting

        setTemperature(BiomeManager.getBiomeAt((int)GameObject.FindGameObjectWithTag("Player").transform.position.x).getTemperature((int)GameObject.FindGameObjectWithTag("Player").transform.position.y));
        setPressure(BiomeManager.getBiomeAt((int)GameObject.FindGameObjectWithTag("Player").transform.position.x).getPressure((int)GameObject.FindGameObjectWithTag("Player").transform.position.y));
    }
コード例 #2
0
    public static void generateNearbyUnloadedChunks()
    {
        Vector3 pos    = GameObject.FindGameObjectWithTag("Player").transform.position;
        int     drillX = (int)pos.x;
        int     drillY = (int)pos.y;

        for (int possibleX = 0; possibleX < drillX + sightHalfWidth * 2; possibleX += chunkSize)
        {
            for (int possibleY = 0; possibleY > drillY - sightHalfHeight * 2; possibleY -= chunkSize)
            {
                Coordinate c = new Coordinate(possibleX, possibleY);
                if (c.isWithinSight(pos, sightHalfWidth, sightHalfHeight, chunkSize))
                {
                    if (c.isInArray(loadedChunkCoordinates))
                    {
                        continue;
                    }
                    loadedChunkCoordinates.Add(c);
                    BiomeManager.getBiomeAt(possibleX).actuallyGenerateChunk(c);
                    return;
                }
            }
        }
    }