Example #1
0
    void Start()
    {
        terrain = GetComponentInParent <TerrainMaster> ();
        //spawn some prefabs!
        //this should use height && slope data to position the resources
        //for various resources:

        /*
         *  Fabric: flat/hilly
         *  Food:   flat/hilly
         *  Luxury:	mostly flat
         *  Mineral:mostly steep
         *
         */
        for (int i = 0; i < 3; i++)
        {
            // position is (1,3)  to (8,6)
            Vector3 spawnPt = terrain.getTileOfType(TerrainMaster.TILE_TYPES.GRASSLAND);
            //	spawnPt.y = terrain.Sample (spawnPt.x, spawnPt.z);
            Instantiate(mineralPrefab, spawnPt, new Quaternion());

            spawnPt = terrain.getTileOfType(TerrainMaster.TILE_TYPES.GRASSLAND);
            //	spawnPt.y = terrain.Sample (spawnPt.x, spawnPt.z);
            Instantiate(fabricPrefab, spawnPt, new Quaternion());

            spawnPt = terrain.getTileOfType(TerrainMaster.TILE_TYPES.GRASSLAND);
            //	spawnPt.y = terrain.Sample (spawnPt.x, spawnPt.z);
            Instantiate(foodPrefab, spawnPt, new Quaternion());

            spawnPt = terrain.getTileOfType(TerrainMaster.TILE_TYPES.GRASSLAND);
            //	spawnPt.y = terrain.Sample (spawnPt.x, spawnPt.z);
            Instantiate(luxuryPrefab, spawnPt, new Quaternion());
        }
    }
        public TerrainChunk(Vector3 center, TerrainMaster terrainMaster)
        {
            this.center        = center;
            this.terrainMaster = terrainMaster;

            ThreadWorkManager.RequestWork(Generate);
        }
Example #3
0
    // Use this for initialization
    void Start()
    {
        terrain = GetComponent <TerrainMaster> ();
        extents = terrain.getExtents();

        int w = (int)(extents.x / delta + 0.5f);
        int h = (int)(extents.y / delta + 0.5f);

        grid = new float[w, h];
    }
Example #4
0
    void Start()
    {
        terrainMaster = GetComponent <TerrainMaster>();

        maxViewDistance             = levelsOfDetail[levelsOfDetail.Length - 1].visibleDistanceThreshold;
        chunkSize                   = TerrainMaster.chunkSize - 1;
        chunksVisibleInViewDistance = Mathf.RoundToInt(maxViewDistance / chunkSize);

        UpdateVisibleChunks();
    }
    public override void OnInspectorGUI()
    {
        TerrainMaster terrainMaster = (TerrainMaster)target;

        DrawDefaultInspector();

        if (GUILayout.Button("Generate"))
        {
            terrainMaster.DrawMapInEditor();
        }
    }
Example #6
0
    void Start()
    {
        // From same GameObject
        _intAnim = GetComponent <Animator>();

        // From other GameObject
        _terrain          = FindObjectOfType <TerrainMaster>();
        hipsPIDController = FindObjectOfType <HipsPIDController>();
        rbController      = FindObjectOfType <RigidBodyControllerSimpleAnimator>();

        // Get lists from SetSkeletons
        RetrieveBones();
    }
Example #7
0
    //float harvest_radius???
    //list of child resources???

    // Use this for initialization
    void Start()
    {
        terrain = GameObject.FindGameObjectWithTag("Terrain").GetComponent <TerrainMaster>();


        Vector3 pos = transform.position;

        pos.y = terrain.Sample(pos.x, pos.z);

        transform.position = pos;

        cityName = "Village";
    }
Example #8
0
    void Start()
    {
        // From same GameObject
        _body    = GetComponent <Rigidbody>();
        _anim    = GetComponent <Animator>();
        _terrain = GetComponent <TerrainMaster>();
        //_hipsPIDController = GetComponent<HipsPIDController>(); <-- MODIFIED

        // It takes it from Inspector
        //_groundChecker = transform.GetChild(0);
        //_groundChecker = transform.GetChild(transform.childCount - 1); // Since we disable gravity in our RB, we use to check ground

        // Set CoM for lower-body into the hips
        _body.centerOfMass = rootKinematicSkeleton.localPosition;
    }
Example #9
0
    // Start is called before the first frame update
    void Start()
    {
        // Create instance for the PID (not attached to GameObject)
        _pidController = new PIDController();

        // From same GameObject
        _anim          = GetComponent <Animator>();
        _rb            = GetComponent <Rigidbody>();
        _feetIK        = GetComponent <IKFeetPlacement>();
        _projectedCOMs = GetComponent <ProjectCOM>();
        _terrain       = GetComponent <TerrainMaster>();

        // Get object to be balance (connected to joint) and change CoM if necessary
        _rbObjectConnected = hipsConnector.GetComponent <Rigidbody>();
        _rbObjectConnected.centerOfMass = _rbObjectConnected.centerOfMass + centerOfMassChangeUp * transform.up;
    }