예제 #1
0
    // Use this for initialization
    void Start()
    {
        GameObject   wMapping     = GameObject.FindWithTag("worldMapping");
        WorldMapping worldMapping = wMapping.GetComponent <WorldMapping> ();

        GameObject      portal          = GameObject.FindWithTag("playerPortal");
        PortalPlacement portalPlacement = portal.GetComponent <PortalPlacement>();

        transform.Translate(new Vector3(worldMapping.gridCoordinates [portalPlacement.portalX], worldMapping.floorHeight, worldMapping.gridCoordinates [portalPlacement.portalZ]));
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        GameObject   wMapping     = GameObject.FindWithTag("worldMapping");
        WorldMapping worldMapping = wMapping.GetComponent <WorldMapping> ();

        GameObject      portal          = GameObject.FindWithTag("playerPortal");
        PortalPlacement portalPlacement = portal.GetComponent <PortalPlacement>();

        Vector3 portaltemp = new Vector3(worldMapping.gridCoordinates[portalPlacement.portalX], worldMapping.floorHeight, worldMapping.gridCoordinates[portalPlacement.portalZ]);

        gruntSpawnPos = new Vector3(portaltemp.x + 1.5f, portaltemp.y + 0.25f, portaltemp.z);

        SpawnNewGrunt();
    }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        GameObject   wMapping     = GameObject.FindWithTag("worldMapping");
        WorldMapping worldMapping = wMapping.GetComponent <WorldMapping> ();

        GameObject      portal          = GameObject.FindWithTag("playerPortal");
        PortalPlacement portalPlacement = portal.GetComponent <PortalPlacement>();

        Vector3 portaltemp = new Vector3(worldMapping.gridCoordinates[portalPlacement.portalX], worldMapping.floorHeight, worldMapping.gridCoordinates[portalPlacement.portalZ]);

        portalPos = new Vector3(portaltemp.x, portaltemp.y, portaltemp.z);

        healthBarLength = (portalWindowWidth - 10) / (maxHp / currentHp);
    }
예제 #4
0
    private float moveToDistance; // Variable used in raycast calc

    // Called upon object initialization
    void Start()
    {
        // Find scripts by referencing the tags of the "fake" objects scripts are attached to.
        // Get data from those scripts, data used here is grid position of portal x,z and the x,y,z coordinates of the given grid position.
        GameObject   wMapping     = GameObject.FindWithTag("worldMapping");
        WorldMapping worldMapping = wMapping.GetComponent <WorldMapping> ();

        GameObject      portal          = GameObject.FindWithTag("playerPortal");
        PortalPlacement portalPlacement = portal.GetComponent <PortalPlacement>();

        // portaltemp - temp storage of x,y,z values of portal, calculated by x,z values of portals grid location.
        Vector3 portaltemp = new Vector3(worldMapping.gridCoordinates[portalPlacement.portalX], worldMapping.floorHeight, worldMapping.gridCoordinates[portalPlacement.portalZ]);

        healthBarLength = (gruntWindowWidth - 10) / (maxHp / currentHp);       // set value of HealthBarLength, variable size based on current HP.
    }
예제 #5
0
    void Awake()
    {
        // Create an Object instance of Class worldMapping and get component"script" so variables can be used.
        GameObject   wMapping     = GameObject.FindWithTag("worldMapping");
        WorldMapping worldMapping = wMapping.GetComponent <WorldMapping> ();

        portalX = Random.Range(3, worldMapping.worldSize - 3);
        portalZ = Random.Range(3, (worldMapping.worldSize / 4));

        Vector3    floorGridPosition = new Vector3(worldMapping.gridCoordinates[portalX], worldMapping.floorHeight, worldMapping.gridCoordinates[portalZ]);
        GameObject PlayerPortal      = (GameObject)Instantiate(playerPortal, floorGridPosition, Quaternion.identity);

        PlayerPortal.name = "playerPortal";

        playerPortalReady = true;
    }
예제 #6
0
    void BuildWorldFloor()
    {
        // Create an Object instance of Class worldMapping and get component"script" so variables can be used.
        GameObject   wMapping     = GameObject.FindWithTag("worldMapping");
        WorldMapping worldMapping = wMapping.GetComponent <WorldMapping> ();

        int floorTileNumber = 0;

        for (int iz = 0; iz < worldMapping.worldSize; iz++)
        {
            for (int ix = 0; ix < worldMapping.worldSize; ix++)
            {
                // Create a new floorTile @ position mapped out in worldMapping Class
                Vector3    floorGridPosition = new Vector3(worldMapping.gridCoordinates[ix], worldMapping.floorHeight - 0.06125f, worldMapping.gridCoordinates[iz]);
                GameObject FloorTile         = (GameObject)Instantiate(floorTile, floorGridPosition, Quaternion.identity);

                // Rename tile to tile number - x,z coordinates - floortile and parent to empty WorldGrid object
                FloorTile.name             = floorTileNumber + " " + worldMapping.gridCoordinates[ix] + " " + worldMapping.gridCoordinates[iz] + " FloorTile";
                FloorTile.transform.parent = WorldGrid.transform;
                floorTileNumber++;
            }
        }
    }