コード例 #1
0
    private void SpawnHouseInLevel()
    {
        levelController       = GameObject.Find("LevelController") as GameObject;
        levelControllerScript = levelController.GetComponent <LevelControllerScript>();

        Debug.Log(mapRows);
        int houseWidth  = Random.Range(10, 15);
        int houseHeight = Random.Range(10, 15);

        int plotTopLeftCornerX = Random.Range(0, mapCols - (houseWidth + 1));
        int plotTopLeftCornerY = Random.Range(0 + houseHeight, mapRows);

        int orientation = Random.Range(0, 4);

        int enterWidth  = Random.Range(3, 5);
        int enterHeight = Random.Range(3, 5);

        for (int i = 0; i < 100; ++i)
        {
            levelControllerScript.ReplaceTile(Random.Range(0, mapCols), Random.Range(0, mapRows), woodTile);
        }
        for (int i = 0; i < 100; ++i)
        {
            levelControllerScript.SpawnItem(Random.Range(0, mapCols), Random.Range(0, mapRows), item);
        }

        levelControllerScript.ReplaceTile(5, 5, woodTile);
    }
コード例 #2
0
ファイル: stargate.cs プロジェクト: sumandotodos/WisdominiRPG
    new void Awake()
    {
        level = GameObject.Find("LevelController").GetComponent <LevelControllerScript>();

        if (explicitName != "")
        {
            deactivate();
            if (level.retrieveBoolValue(explicitName + "StargateActivated"))
            {
                activate();
            }
        }


        else
        {
            deactivate();

            if (cheat || level.retrieveBoolValue(level.locationName + "StargateActivated"))
            {
                activate();
            }
            bool g = level.retrieveBoolValue(level.locationName + "StargateActivated");
            Debug.Log("<color=blue>" + level.locationName + "StargateActivated = " + g + "</color>");
        }
    }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        cam   = GameObject.Find("Main Camera").GetComponent <Camera> ();

        matchedButtons    = 0;
        state             = 0;
        generatedSequence = level.retrieveStringValue(simonSequenceVariable);
        Debug.Log("Generated seq: " + generatedSequence);
        if (generatedSequence == null)
        {
            generatedSequence = "";
        }
        if (generate)
        {
            if (generatedSequence.Equals(""))
            {
                generateSequence();
            }
            //state = 1;
        }
        for (int i = 0; i < button.Length; ++i)           // propagate level & controller & misc reference
        {
            button [i].level       = level;
            button [i].controller  = this;
            button [i].buttonId    = i;
            button [i].playerInput = !generate;
            button [i].cam         = cam;
        }
    }
コード例 #4
0
 void Start()
 {
     masterController = GameObject.Find("MasterController").GetComponent <MasterControllerScript> ();
     ds    = masterController.getStorage();
     cam   = GameObject.Find("CameraLerp").GetComponent <CameraManager> ();
     level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
 }
コード例 #5
0
    // Use this for initialization
    new void Start()
    {
        level  = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        master = GameObject.Find("MasterController").GetComponent <MasterControllerScript> ();
        ds     = master.getStorage();

        originalPos = this.transform.position;

        bool isOpen = ds.retrieveBoolValue(PanelID + "isOpen");

        if (isOpen)
        {
            X = targetX = displacedX;
            switch (axis)
            {
            case FakePanelAxis.x:
                this.transform.position = new Vector3(originalPos.x + X, originalPos.y, originalPos.z);
                break;

            case FakePanelAxis.y:
                this.transform.position = new Vector3(originalPos.x, originalPos.y + X, originalPos.z);
                break;

            case FakePanelAxis.z:
                this.transform.position = new Vector3(originalPos.x, originalPos.y, originalPos.z + X);
                break;
            }
        }
        else
        {
            X = targetX = 0.0f;
        }
    }
コード例 #6
0
 // Use this for initialization
 void Start()
 {
     lvl          = FindObjectOfType <LevelControllerScript>();
     footsoundMgr = GameObject.Find("FootstepSoundManager").GetComponent <FootstepSoundManager>();
     RecoilRemain = RecoilTime;
     enabled      = true;
 }
コード例 #7
0
 void Start()
 {
     if (level == null)
     {
         level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
     }
 }
コード例 #8
0
    void OnTriggerEnter(Collider other)
    {
        if (level == null)
        {
            level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        }
        if (other.tag == "Player")
        {
            string loc = level.locationName;
            if (!targetLocation.Equals(""))
            {
                loc = targetLocation;
            }

            float x = this.transform.position.x;
            float z = this.transform.position.z;

            ds.storeFloatValue("Coords" + loc + "X", x);
            ds.storeFloatValue("Coords" + loc + "Y", other.transform.position.y);
            ds.storeFloatValue("Coords" + loc + "Z", z);

            //level.storePhysicalCameraPosition ();

//			ds.storeFloatValue ("Pos" + loc + "X", cam.gameObject.transform.position.x);
//			ds.storeFloatValue ("Pos" + loc + "Y", cam.gameObject.transform.position.y);
//			ds.storeFloatValue ("Pos" + loc + "Z", cam.gameObject.transform.position.z);
//			ds.storeFloatValue ("Rot" + loc + "Y", cam.pivotY.transform.localEulerAngles.y);
//			ds.storeFloatValue ("Rot" + loc + "X", cam.pivotX.transform.localEulerAngles.x);
//			ds.storeFloatValue ("PosIn" + loc + "Z", cam.pivotZ.transform.localPosition.z);
            //ds.storeFloatValue ("PosIn" + loc + "M", cam.mainCamera.transform.localPosition.z);
        }
    }
コード例 #9
0
    void Start()
    {
        //connect with level controller and script
        levelController       = GameObject.Find("LevelController");
        levelControllerScript = levelController.GetComponent <LevelControllerScript> ();

        //find the rows and columns in of the level grid
        mapRows = levelControllerScript.GetMapRows();
        mapCols = levelControllerScript.GetMapCols();

        //calculate maximum camera zoom //Orthographic size = ((Vert Resolution)/(PPUScale * PPU)) * 0.5
        cameraCurrentZoom            = ((Screen.height) / (ppuScale * 32)) * 0.5000f;
        cameraZoomMax                = cameraCurrentZoom;
        Camera.main.orthographicSize = cameraCurrentZoom;

        //make the camera less sensitive as we zoom in
        cameraSpeedCutBy = originalCameraSpeedCutBy * (cameraCurrentZoom / cameraZoomMax);

        //czm is for viewing only
        czm = cameraCurrentZoom;

        //get the dimensions of the camera (screen resolution), save values in max variables
        camHeight    = 2f * cam.orthographicSize;
        camWidth     = camHeight * cam.aspect;
        maxCamWidth  = camWidth;
        maxCamHeight = camHeight;
    }
コード例 #10
0
 // Use this for initialization
 protected void Start()
 {
     levelControllerScript = GameObject.Find("LevelController").GetComponent <LevelControllerScript>();
     levelGrid             = levelControllerScript.GetLevelGrid();
     mapCols = levelControllerScript.GetMapCols();
     mapRows = levelControllerScript.GetMapRows();
 }
コード例 #11
0
    public void _wm_switchChannel(int ch)
    {
        for (int i = 0; i < channel.Length; ++i)
        {
            if (i == ch)
            {
                channel [i].SetActive(true);
            }
            else
            {
                channel [i].SetActive(false);
            }
        }

        if (reentrant)
        {
            if (level == null)
            {
                level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
            }
            if (level != null)
            {
                level.storeIntValue("TVChannel" + screenId, ch);
            }
        }
    }
コード例 #12
0
    // Use this for initialization
    void Start()
    {
        //load prefabs
        corridor = Resources.Load("Prefabs/Environment/Corridor") as GameObject;
        floor    = Resources.Load("Prefabs/Environment/Floor") as GameObject;
        wall     = Resources.Load("Prefabs/Environment/Wall") as GameObject;
        door     = Resources.Load("Prefabs/Environment/Door") as GameObject;
        unused   = Resources.Load("Prefabs/Environment/Unused") as GameObject;

        //grab enemies from prefabs
        vagrant = Resources.Load("Prefabs/NPCs/Vagrant") as GameObject;


        //find levelController
        levelControllerScript = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();

        myX = levelControllerScript.GetMapCols();
        myY = levelControllerScript.GetMapRows();

        ChangeLevel(0, 0);


        for (int i = 0; i < 10; ++i)
        {
            int x = Random.Range(0, _width);
            int y = Random.Range(0, _height);
            Debug.Log(x + ", " + y);
            if (levelControllerScript.GetLevelGrid()[x, y].GetComponent <TileScript> ().IsGround())
            {
                levelControllerScript.SpawnLivingThing(vagrant, x, y);
            }
        }
        levelControllerScript.FillNPCList();
    }
コード例 #13
0
    new void reset()
    {
        if (level == null)
        {
            level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        }

        if (player == null)
        {
            player = GameObject.Find("Player").GetComponent <PlayerScript> ();
        }

        if (dark)
        {
            timeToCompletion = darkMeditationTime;
        }
        else
        {
            timeToCompletion = meditationTime;                  // 40 seconds //(float)Random.Range (minMeditationDuration, maxMeditationDuration);
        }
        breather = GameObject.Find("Breather").GetComponent <UIBreather> ();

        meditationState = MeditationState.idle;
        fruit.reset();
    }
コード例 #14
0
    public void initialize()
    {
        anim = roca.GetComponent <Animator> ();

        level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();

        r     = this.GetComponent <Rigidbody> ();
        angle = FloatRandom.floatRandomRange(0.0f, 6.28f);
    }
コード例 #15
0
 void Start()
 {
     level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
     if (reentrant)
     {
         curChannel = level.retrieveIntValue("TVChannel" + screenId);
     }
     _wm_switchChannel(curChannel);
 }
コード例 #16
0
    // Use this for initialization
    void Start()
    {
        base.Start();
        levelControllerScript = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        camera = GameObject.Find("Main Camera");
        camera.transform.position = new Vector3(transform.position.x, transform.position.y, camera.transform.position.z);

        //stats
        speed = 20;
    }
コード例 #17
0
 // Use this for initialization
 void Start()
 {
     accomplished = new bool[3];
     lvl          = FindObjectOfType <LevelControllerScript>();
     for (int i = 0; i < 3; ++i)
     {
         accomplished[i] = lvl.retrieveBoolValue(this.name + "Accomplised" + i);
     }
     player = FindObjectOfType <PlayerScript>();
 }
コード例 #18
0
 void Start()
 {
     if (level == null)
     {
         level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
     }
     if (dialogue == null)
     {
         dialogue = GameObject.Find("DialogueObject").GetComponent <DialogueObject> ();
     }
 }
コード例 #19
0
 // Use this for initialization
 void Start()
 {
     level         = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
     currentAmount = level.retrieveIntValue("TVFerfuflosTimes" + id);
     if (currentAmount == amount)
     {
         tvChannelSwitch._wm_switchChannel(1);
         level.storeIntValue("TVFerfuflosClearFirstTime", 1);
     }
     _wm_storeTVid();
     alert = GameObject.Find("AlertImage").GetComponent <alertImageController> ();
 }
コード例 #20
0
 // Use this for initialization
 new void Start()
 {
     height       = minHeight;
     activated    = false;
     targetHeight = minHeight;
     initialPos   = levelPiece.transform.localPosition;
     levelPiece.transform.localPosition = new Vector3(initialPos.x, height, initialPos.z);
     if (level_N == null)
     {
         level_N = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
     }
 }
コード例 #21
0
 // Use this for initialization
 new void Start()
 {
     level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
     for (int i = 1; i <= barreritas.Length; ++i)           // reentrancy
     {
         string variable = baseVariableName.Replace("<1>", "" + i);
         if (level.retrieveBoolValue(variable))
         {
             _wm_deleteBarrier(i - 1);
         }
     }
 }
コード例 #22
0
    // Use this for initialization
    void Start()
    {
        woodTile = Resources.Load("Prefabs/Environment/WoodWall") as GameObject;
        item     = Resources.Load("Prefabs/Items/Item") as GameObject;

        levelController       = GameObject.Find("LevelController") as GameObject;
        levelControllerScript = levelController.GetComponent <LevelControllerScript>();
        mapRows = levelControllerScript.GetMapRows();
        mapCols = levelControllerScript.GetMapCols();
        levelControllerScript.ReplaceTile(0, 0, woodTile);
        GenerateLevel();
    }
コード例 #23
0
    // Start is called before the first frame update
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        //   else if (instance != null)
        //     Destroy(gameObject);

        sceneIndex  = SceneManager.GetActiveScene().buildIndex;
        levelPassed = PlayerPrefs.GetInt("LevelPassed");
    }
コード例 #24
0
    void Reset()
    {
        //ds = mcRef.getStorage ();
        level         = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        camDirections = new List <string> ();
        GameObject[] directions = GameObject.FindGameObjectsWithTag("CamDirection");

        for (int i = 0; i < directions.Length; i++)
        {
            camDirections.Add(directions [i].name);
        }
    }
コード例 #25
0
    // Use this for initialization
    void Start()
    {
        level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        bool d1 = level.retrieveBoolValue("HasFerfufloDice1");
        bool d2 = level.retrieveBoolValue("HasFerfufloDice2");
        bool d3 = level.retrieveBoolValue("HasFerfufloDice3");

        if (d1 && d2 && d3)
        {
            level.storeBoolValue("HasAllFerfufloDice", true);
        }
    }
コード例 #26
0
 new void Start()
 {
     level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
     state = DoorState.Closed;
     isWaitingForActionToComplete = false;
     angle            = -180.0f;
     audio            = this.GetComponent <AudioSource>();
     masterController = GameObject.Find("MasterController").GetComponent <MasterControllerScript> ();
     if (masterController.getStorage().retrieveBoolValue("IsDoor" + this.name + "Open"))
     {
         _wm_immediateOpen();
     }
 }
コード例 #27
0
    void Start()
    {
        for (int i = 0; i < magos.Length; i++)
        {
            magos [i].SetActive(false);
        }

        lvl = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();

        numMago = lvl.retrieveIntValue("MagoElegido");

        magos [numMago].SetActive(true);
    }
コード例 #28
0
    void Start()
    {
        lvl    = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        player = GameObject.Find("Player").GetComponent <PlayerScript> ();
        if (lvl.retrieveBoolValue(mapVariable))
        {
            Destroy(this.gameObject);
        }

        fogLinEnd        = RenderSettings.fogEndDistance;
        fogLinStart      = RenderSettings.fogStartDistance;
        originalFogColor = RenderSettings.fogColor;
    }
コード例 #29
0
    // Start is called before the first frame update
    void Start()
    {
        LevelControllerScript level = FindObjectOfType <LevelControllerScript>();

        if (level != null)
        {
            int value = level.retrieveIntValue(VarName);
            if (value > 0)
            {
                Destroy(this.gameObject);
            }
        }
    }
コード例 #30
0
 // Use this for initialization
 void Start()
 {
     if (levelController == null)
     {
         levelController = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
     }
     going = false;
     if (levelController.retrieveBoolValue(StorageVariable))
     {
         going = true;
     }
     timeRemaining = -1.0f;
 }