Manage resetting the player's position if they fall off
Inheritance: MonoBehaviour
Exemplo n.º 1
0
    void Awake()
    {
        // Implement this object as a Singleton
        if (instance == null)
        {
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);

        //Assign enemies to a new List of Enemy objects.
        enemies = new List <Enemy> ();

        //Get a component reference to the attached BoardManager script
        worldScript   = GetComponent <WorldManager> ();
        dungeonScript = GetComponent <DungeonManager> ();

        //Call the InitGame function to build the world
        InitGame();
    }
Exemplo n.º 2
0
 public void Start()
 {
     moving   = false;
     dm       = FindObjectOfType <DungeonManager>();
     dc       = FindObjectOfType <DresdenController>();
     doorInfo = GetComponent <Door>();
 }
        private void OnAnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameIndex)
        {
            CameraUtils.Shake();

            IList <MonsterEntity2D> monsters = DungeonManager.GetInstance().monsters;

            for (int index = monsters.Count - 1; index >= 0; index--)
            {
                MonsterEntity2D mosnter = monsters[index];

                if (mosnter.motor2D.isGrounded)
                {
                    mosnter.OnSkillHit(owner, data, owner.transform.position);

                    if (mosnter.machine.currentState.GetName() == StateTypes.Dead.ToString())
                    {
                        ComponentDefaultEffect componentEffect = mosnter.gameObject.AddComponent <ComponentDefaultEffect>();
                        componentEffect.spinEnabled = false;
                        componentEffect.minForce    = 0.5f;
                        componentEffect.maxForce    = 1.0f;
                        componentEffect.gravity     = -6.0f;
                        componentEffect.minSpeed    = 0.4f;
                        componentEffect.maxSpeed    = 0.6f;
                    }
                }
            }
        }
Exemplo n.º 4
0
    void Awake()
    {
        if (!room)
        {
            room = GetComponentInParent <DungeonRoomController>();
        }
        if (!dungeonManager)
        {
            dungeonManager = FindObjectOfType <DungeonManager>();
        }
        if (!enemyController)
        {
            enemyController = GetComponent <EnemyController>();
        }

        enemyController.GivesExperienceWhenKilled = false;
        //enemyController.HandleFightBack = t;


        if (!attackRadiusCollider || !activateRadiusCollider)
        {
            var colliders = GetComponents <SphereCollider>();
            if (colliders.Length == 2)
            {
                attackRadiusCollider   = colliders[0];
                activateRadiusCollider = colliders[1];
            }
            else
            {
                Debug.LogError("Blerp");
            }
        }

        name = "___DUNGEON__BOSS___";
    }
Exemplo n.º 5
0
    void Update()
    {
        int            i;
        DungeonManager dungeonManager = FindObjectOfType <DungeonManager>();

        Hero[]     dungeonHeroes = dungeonManager.dungeonHeroes;
        List <int> currentHealth = dungeonManager.currentHealth;

        if (this.tag == "Hero1")
        {
            i = 0;
        }
        else if (this.tag == "Hero2")
        {
            i = 1;
        }
        else if (this.tag == "Hero3")
        {
            i = 2;
        }
        else
        {
            return;
        }

        if (dungeonHeroes[i] == null)
        {
            return;
        }
        healthFraction       = (float)currentHealth[i] / (float)dungeonHeroes[i].getMaxHealth();
        localScale           = maxScale;
        localScale.x         = healthFraction * maxScale.x;
        transform.localScale = localScale;
    }
Exemplo n.º 6
0
    /// <summary>
    /// ダンジョン内にスポーンする
    /// </summary>
    protected void Spawn()
    {
        _dungeonManager = DungeonManager.instance;

        Vector2Int pos;
        bool       flag = true;
        int        sectionNo;

        do
        {
            var sections = _dungeonManager._floor._sections;
            sectionNo = Random.Range(0, sections.Count);
            var room = sections[sectionNo]._roomData;

            pos = new Vector2Int(Random.Range(room.left, room.right + 1), -Random.Range(room.top, room.bottom + 1));

            if (_dungeonManager._floor.GetTerrainData(pos) == Floor.TerrainType.Floor)
            {
                if (_dungeonManager._floor.GetCharacterData(pos) == -1)
                {
                    flag = false;
                }
            }
        } while (flag);

        Init(pos, sectionNo);
    }
Exemplo n.º 7
0
 private void Awake()
 {
     dungeonManager = GameObject.FindGameObjectWithTag("DungeonManager").GetComponent <DungeonManager>();
     id_dungeon     = -1;
     subject        = "";
     dungeonDone    = false;
 }
Exemplo n.º 8
0
    /// <summary>
    /// ランダムでひとつマスイベントを選び、イベントを呼ぶ
    /// </summary>
    /// <param name="dm">dungeonManager</param>
    private void RandomSquareEvent(DungeonManager dm)
    {
        MapManager           mm = MapManager.Instance;
        List <DungeonSquare> mayAppearDungeonSquares = new List <DungeonSquare>();

        foreach (DungeonSquare ds in mm.MayAppearDungeonSquares)
        {
            switch (ds.SquareType)
            {
            case E_DungeonSquareType.呪いの宝箱:
            case E_DungeonSquareType.回復の泉:
            case E_DungeonSquareType.宝箱:
            case E_DungeonSquareType.店:
            case E_DungeonSquareType.祈祷:
            case E_DungeonSquareType.罠:
            case E_DungeonSquareType.通常戦闘:
            case E_DungeonSquareType.闇商人:
            case E_DungeonSquareType.なにもなし:
                mayAppearDungeonSquares.Add(ds);
                break;
            }
        }

        mayAppearDungeonSquares[UnityEngine.Random.Range(0, mayAppearDungeonSquares.Count)].SquareEvent(dm);
    }
Exemplo n.º 9
0
    private void Awake()
    {
        // create floors
        dungMan = FindObjectOfType <DungeonManager>();

        GameObject goFloor = Instantiate(dungMan.floorPrefab, transform.position, Quaternion.identity);

        goFloor.name = dungMan.floorPrefab.name;
        goFloor.transform.SetParent(dungMan.transform);

        if (transform.position.x > dungMan.maxX)
        {
            dungMan.maxX = transform.position.x;
        }
        if (transform.position.x < dungMan.minX)
        {
            dungMan.minX = transform.position.x;
        }
        if (transform.position.y > dungMan.maxY)
        {
            dungMan.maxY = transform.position.y;
        }
        if (transform.position.y < dungMan.minY)
        {
            dungMan.minY = transform.position.y;
        }
    }
Exemplo n.º 10
0
    //Awake is always called before any Start functions
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);

        //Assign enemies to a new List of Enemy objects.
        enemies = new List <Enemy>();

        boardScript   = GetComponent <DungeonBoardManager>();
        dungeonScript = GetComponent <DungeonManager>();
        playerScript  = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();

        //Call the InitGame function to initialize the first level
        InitGame();
    }
Exemplo n.º 11
0
        public void Initialize(KeyValuePair <int, string> data)
        {
            this.data = data;

            iconBtn.normalSprite = data.Value;

            if (this.data.Key <= UserManager.GetInstance().user.dungeonIndex)
            {
                iconBtn.gameObject.SetActive(true);
                UIEventListener.Get(iconBtn.gameObject).onClick = (GameObject go) =>
                {
                    DungeonManager.GetInstance().currentDungeonIndex = data.Key;

                    SoundManager.GetInstance().PlayOneShot(AudioRepository.COMMON_BUTTON_PRESS.AsAudioClip());

                    LayerManager.GetInstance().RemovePopUpView <DungeonSelectWindow>();

                    #region Transtion Logic
                    FadeTransition transition = new FadeTransition()
                    {
                        nextScene   = GlobalDefinitions.SCENE_DUNGEON_INDEX,
                        fadedDelay  = 0.3f,
                        fadeToColor = Color.black
                    };

                    TransitionEngine.instance.transitionWithDelegate(transition);
                    #endregion
                };
            }
            else
            {
                iconBtn.gameObject.SetActive(false);
            }
        }
Exemplo n.º 12
0
    private void Init(Upload upload, string stage, int sceneOnVictory, int sceneOnExit)
    {
        DontDestroyOnLoad(this.gameObject);
        DungeonManager dungeon = DungeonManager.Instance;
        DungeonInfo    info    = DungeonInfo.Instance;

        SerializationUtil.DeserializeDungeonToPlayable(
            upload,
            stage,
            sceneOnVictory,
            sceneOnExit,
            info,
            dungeon.gameObject,
            floorPrefab,
            wallPrefab,
            upstairsPrefab,
            downstairsPrefab,
            goldKeyPrefab,
            blueKeyPrefab,
            redKeyPrefab,
            playerPrefab,
            exitPrefab,
            goldDoorPrefab,
            blueDoorPrefab,
            redDoorPrefab,
            enemyPrefab,
            boosterPrefab);
        Debug.Log("deserialized");
    }
Exemplo n.º 13
0
    void AddADungeon()
    {
        DungeonManager newDung = new DungeonManager();

        dungeonList.myDungeons.Add(newDung);
        viewIndex = dungeonList.myDungeons.Count;
    }
Exemplo n.º 14
0
 public void Continue()
 {
     DungeonManager.ResetScenes();
     Player.Spawn();
     DungeonManager.JumpToRoom(5, 2);
     Play();
 }
Exemplo n.º 15
0
    private void Awake()
    {
        // Instantiate Dungeon Manager
        if (_instance == null)
        {
            _instance = this;
        }
        else if (_instance != this)
        {
            Destroy(gameObject);
        }

        // Catch Pro Camera 2D Room
        pc2dr = Camera.main.gameObject.GetComponent <ProCamera2DRooms>();
        if (pc2dr)
        {
            //rooms = new DungeonRoom[pc2dr.Rooms.Count];

            for (int i = 0; i < rooms.Length; i++)
            {
                //rooms[i] = new DungeonRoom();
                rooms[i].position = pc2dr.Rooms[i].Dimensions.position;
            }
        }
    }
Exemplo n.º 16
0
    //Awake is always called before any Start functions
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);

        //Assign enemies to a new List of Enemy objects.
        enemies = new List <Enemy>();
        //Assign board manager to new board manager
        boardManager  = GetComponent <BoardManager>();
        dungeonManger = GetComponent <DungeonManager>();

        //Call the InitGame function to initialize the first level
        InitGame();

        //Add our callback to sceneloaded delegate
        //SceneManager.sceneLoaded += OnSceneLoaded;
    }
Exemplo n.º 17
0
 public override void SquareEvent(DungeonManager dm)
 {
     Debug.Log("階段イベント発生");
     //階段イベント処理
     dm.ElapseTurn();
     dm.MoveScene(E_DungeonScene.SelectAction);
 }
Exemplo n.º 18
0
 void Start()
 {
     body            = GetComponent <Rigidbody2D>();
     animator        = GetComponent <Animator>();
     player          = GameObject.Find("Player");
     enemyRenderer   = GetComponent <SpriteRenderer>();
     healthText      = GetComponentInChildren <Canvas>().GetComponentInChildren <Text>();
     healthText.text = health.ToString();
     dungeonManager  = GameObject.Find("Map").GetComponent <DungeonManager>();
     questManager    = GameObject.Find("UI").GetComponent <QuestManager>();
     soundManager    = GameObject.Find("Main Camera").GetComponent <SoundManager>();
     uiManager       = GameObject.Find("UI").GetComponent <UIManager>();
     enemies         = GameObject.Find("Enemies");
     if (groundPoundAttack)
     {
         StartCoroutine(GroundPound());
     }
     if (magicAttack)
     {
         StartCoroutine(MagicAttack());
     }
     if (spawnEnemies)
     {
         StartCoroutine(SpawnEnemies());
     }
 }
Exemplo n.º 19
0
    /// <summary>
    /// 出現する敵選択(2~4体)
    /// </summary>
    private void ChooseEnemys(DungeonManager dm)
    {
        List <BattleCharacter> enemys = new List <BattleCharacter>();
        int countOfEnemyKind          = this.mayAppearEnemys.Count;
        int countOfRareEnemyKind      = this.mayAppearRareEnemys.Count;

        for (int i = 0; i < UnityEngine.Random.Range(2, 5); i++)
        {
            if (UnityEngine.Random.Range(0f, 1f) > dm.AppearanceRareEnemyRate)
            {
                BattleCharacter enemy = Instantiate(this.mayAppearEnemys[UnityEngine.Random.Range(0, countOfEnemyKind)], dm.EnemysRootObject.transform);
                enemys.Add(enemy);
            }
            else
            {
                BattleCharacter rareEnemy = Instantiate(this.mayAppearRareEnemys[UnityEngine.Random.Range(0, countOfRareEnemyKind)], dm.EnemysRootObject.transform);
                enemys.Add(rareEnemy);
            }
        }
        dm.Enemys = enemys;

        foreach (BattleCharacter enemy in enemys)
        {
            Debug.Log("敵: " + enemy.CharaClass.CharaName);
        }
        dm.MoveBattleScene();
    }
    private void Awake()
    {
        playerControls = new PlayerControls();

        // Binds fire function to Fire action
        playerControls.Land.Fire.performed += ctx => Fire();

        // Binds e key to inteacting with doors
        playerControls.Land.Interact.performed += ctx => Interact();

        // Grab component from Player
        camera        = this.GetComponentInChildren <Camera>();
        rb            = this.GetComponent <Rigidbody>();
        meleeCollider = this.GetComponent <SphereCollider>();

        // Detact camera so it is not influenced by player rotation
        camera.transform.SetParent(null);

        animator = this.GetComponentInChildren <Animator>();

        playerHealth = this.GetComponent <Health>();

        dungeonManagerGameObject = GameObject.Find("DungeonManager");
        if (dungeonManager != null)
        {
            dungeonManager = dungeonManager.GetComponent <DungeonManager>();
        }
    }
Exemplo n.º 21
0
        void Awake()
        {
            dungeonManager = DungeonManager.instance;
            mapManager     = dungeonManager.mapManager;
            var createBlock = BlockManager.instance.OnCreateBlockAsObservable();

            createBlock.Subscribe(block =>
            {
                var onTap = block.OnTapAsObservable()
                            .Where(_ => dungeonManager.activeState == DungeonState.None)
                            .Select(_ => block.location)
                            .Subscribe(OnTap);

                block.OnBreakAsObservable()
                .Subscribe(_ => onTap.Dispose());
            });

            OnWalkBeginAsObservable()
            .Do(_ => animator.SetBool("moving", true))
            .Select(_ => DungeonState.PlayerMoving)
            .Subscribe(dungeonManager.EnterState);

            OnWalkEndAsObservable()
            .Do(_ => animator.SetBool("moving", false))
            .Subscribe(_ => dungeonManager.ExitState());

            speed = _speed;
        }
Exemplo n.º 22
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        //DontDestroyOnLoad(gameObject);

        enemies          = new List <Enemy>();
        boardScript      = GetComponent <BoardManager>();
        dungeonScript    = GetComponent <DungeonManager>();
        dungeonBSPScript = GetComponent <BSPDungeonManager>();
        if (GameObject.FindGameObjectWithTag("Player"))
        {
            playerOne = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
        }
        textHandle = new TextHandle();
        textHandle.ReadFile("seeds");

        camera3D = FindObjectOfType <HexMapCamera>();


        InitGame();
    }
Exemplo n.º 23
0
    // Use this for initialization
    void Start()
    {
        dungeonCanvas          = GameObject.Find("Dungeon");
        buttonForAtackCharging = GameObject.Find("ChargeAtackButton");
        objectSelector         = dungeonCanvas.GetComponent <ObjectSelector>();
        dungeonManager         = dungeonCanvas.GetComponent <DungeonManager>();
        displayParty           = dungeonCanvas.GetComponent <DisplayParty>();
        dungeonsGenerator      = dungeonCanvas.GetComponent <DungeonsGenerator>();
        fightMode = dungeonCanvas.GetComponent <FightMode>();
        buttonForAtackCharging.SetActive(false);
        buttonIsHeld      = false;
        chargeReachedPeak = false;
        speedTimer        = 0;
        randomNumber      = new System.Random();

        filePath      = "UI_Elements/";
        typeOfElement = new string[] { "ChargeBar", "ChargeBarPointer" };

        if (GameObject.Find("FactoryObject") == null)
        {
            factoryObject       = new GameObject();
            factoryObject.name  = "FactoryObject";
            factoryObject.layer = 0;
            factoryObject.AddComponent <SpriteRenderer>();
            Debug.Log("ButtonForChargingAtack || Start || Created new FactoryObject");
        }
        else
        {
            Debug.Log("ButtonForChargingAtack || Start || Found FactoryObject");
            factoryObject = GameObject.Find("FactoryObject");
        }

        initializeChargeBar();
        loadChargeBarSize();
    }
Exemplo n.º 24
0
        public static void Main()
        {
            Console.OutputEncoding = Encoding.UTF8;
            Console.BufferHeight   = Console.WindowHeight;

            // These lines maximize the window and allows ANSI Colors to be displayed! - Stolen from Google
            Maximize();
            var iStdOut = GetStdHandle(StdOutputHandle);

            if (!GetConsoleMode(iStdOut, out var outConsoleMode))
            {
                Console.WriteLine("failed to get output console mode");
                Console.ReadKey();
                return;
            }
            outConsoleMode |= EnableVirtualTerminalProcessing | DisableNewlineAutoReturn;
            if (!SetConsoleMode(iStdOut, outConsoleMode))
            {
                Console.WriteLine($"failed to set output console mode, error code: {GetLastError()}");
                Console.ReadKey();
                return;
            }

            Console.CursorVisible = false;
            Manager = new DungeonManager();
            Restart();
        }
Exemplo n.º 25
0
        private void TweenGoImage()
        {
            TweenPosition tween = goImg.gameObject.AddComponent <TweenPosition>();

            tween.to              = Vector3.zero;
            tween.from            = goImg.transform.localPosition;
            tween.style           = UITweener.Style.Once;
            tween.delay           = 0.5f;
            tween.duration        = 0.2f;
            tween.ignoreTimeScale = false;
            EventDelegate.Add(tween.onFinished, () =>
            {
                tween.to       = new Vector3((Screen.width + goImg.width), 0, 0);
                tween.from     = Vector3.zero;
                tween.style    = UITweener.Style.Once;
                tween.duration = 0.2f;
                tween.delay    = 0.5f;
                tween.ResetToBeginning();
                EventDelegate.Add(tween.onFinished, () =>
                {
                    LayerManager.GetInstance().RemovePopUpView(this);
                    DungeonManager.GetInstance().StartBattle();
                }, true);

                tween.PlayForward();
            }, true);
            tween.PlayForward();
        }
Exemplo n.º 26
0
    private void Awake()
    {
        if (Instance != null)
        {
            throw new System.Exception();
        }
        Instance = this;

        this.dungeonManager = DungeonManager.Instance;
        foreach (BattleCharacter ally in this.dungeonManager.Allys)
        {
            this.charaList.Add(ally);
            this.allyList.Add(ally);
        }
        foreach (BattleCharacter enemy in this.dungeonManager.Enemys)
        {
            this.charaList.Add(enemy);
            this.enemyList.Add(enemy);
        }
        this.haveActiveItems  = this.dungeonManager.HaveBattleActiveItems;
        this.havePassiveItems = this.dungeonManager.HaveBattlePassiveItems;
        foreach (BattleCharacter bc in this.charaList)
        {
            bc.Start();
        }
    }
Exemplo n.º 27
0
 private void OnMouseDown()
 {
     dungeonManager = FindObjectOfType <DungeonManager>();
     partyHealth    = dungeonManager.currentHealth;
     dungeonHeroes  = dungeonManager.dungeonHeroes;
     Interact();
 }
Exemplo n.º 28
0
    // Start is called before the first frame update
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        XmlSerializer serializer = new XmlSerializer(typeof(Setup));

        FileStream file  = new FileStream(designFileName, FileMode.Open);
        Setup      setup = (Setup)serializer.Deserialize(file);

        placeDesigns = false;
        stillActive1 = true;
        stillActive2 = false;
        setEdges     = false;
        backGround   = false;
        firstSeed    = true;
        secondSeed   = true;

        count     = 0;
        index     = 0;
        generator = GetComponent <DungeonGenerator>();
        generator.InitFromSetup(setup, setup.map.Seed);
        rect   = new RectFill(0, 0, generator.SizeX, generator.SizeY, generator.Background);
        number = generator.SizeX * generator.SizeY;
    }
Exemplo n.º 29
0
        /// <summary> Gets inputted actions from the player. </summary>
        /// <param name="actions">A set of actions to execute in the current frame.</param>
        protected override void GetInput(out HashSet <CustomInput.UserInput> actions)
        {
            Up = Down = Left = Right = false;
            this.actions.Clear();
            actions = this.actions;

            Collider2D[] targets = behavior.getEnemiesInRange(25);
            if (targets.Length == 0)
            {
                // Reset the level if all enemies are dead.
                DungeonManager.StartResetTitleScreen();
                return;
            }
            if (currentEnemy != targets[0])
            {
                ResetDemoHero();
            }
            currentEnemy = targets[0];
            goal         = currentEnemy.transform.position;

            switch (this.state)
            {
            case AIState.DelaySwitch: DelaySwitch(); break;

            case AIState.FindTarget: FindTarget(); break;

            case AIState.Approach: Approach(); break;

            case AIState.Target: Target(); break;

            case AIState.Swing: Swing(); break;

            case AIState.Shoot: Shoot(); break;
            }
        }
Exemplo n.º 30
0
 private void Awake()
 {
     dungMan    = FindObjectOfType <DungeonManager>();
     floor      = Instantiate(dungMan.floorPrefab, transform.position, Quaternion.identity) as GameObject;
     floor.name = dungMan.floorPrefab.name;
     floor.transform.SetParent(dungMan.transform);
     //SHOWS  MAX X POSITION AND MAX Y POSITION//
     if (transform.position.x > dungMan.maxX)
     {
         dungMan.maxX = transform.position.x;
     }
     if (transform.position.x < dungMan.minX)
     {
         dungMan.minX = transform.position.x;
     }
     if (transform.position.y > dungMan.maxY)
     {
         dungMan.maxY = transform.position.y;
     }
     if (transform.position.y < dungMan.minY)
     {
         dungMan.minY = transform.position.y;
     }
     //SHOWS  MAX X POSITION AND MAX Y POSITION//
 }
Exemplo n.º 31
0
    public override void ActivateEffect(GameObject activator, float value, Collision2D coll, Collider2D other)
    {
        if (dungeonManager == null)
        {
            dungeonManager = (DungeonManager) FindObjectOfType(typeof(DungeonManager));
        }

        if (dungeonManager != null)
        {
            StartCoroutine(DoResetDungeon());
        }
    }
Exemplo n.º 32
0
    // Use this for initialization
    void Start()
    {
        dungeonManagerScript = GameObject.FindGameObjectWithTag("DungeonManager").GetComponent("DungeonManager") as DungeonManager;
        uiManagerScript = GameObject.FindGameObjectWithTag("uiManager").GetComponent("UIManager") as UIManager;

        uiManagerScript.InitValues(dungeonManagerScript.width, dungeonManagerScript.height, dungeonManagerScript.minRoomSize, dungeonManagerScript.maxRoomSize,
                                   dungeonManagerScript.chanceOfExtraDoor, false);
        camControls = GameObject.FindGameObjectWithTag("MainCamera").GetComponent("CameraControls") as CameraControls;

        if (Cursor.lockState == CursorLockMode.Locked){
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible = true;
        }
    }
Exemplo n.º 33
0
	public void Awake()
	{
		// grab game master
		gameMaster = GetComponent<GameMaster>();

		// grab child managers
		hubManager = GetComponentInChildren<HubManager>();
		levelEditorManager = GetComponentInChildren<LevelEditorManager>();
		dungeonManager = GetComponentInChildren<DungeonManager>();
		cipherManager = GetComponentInChildren<CipherManager>();
		motiveManager = GetComponentInChildren<MotiveManager>();
		networkManager = GetComponentInChildren<NetworkManager>();

	}
Exemplo n.º 34
0
    void Start()
    {
        rooms = new int[7,7];
        spawnEnemies = manager.GetComponent<SpawnEnemies>();

        dungeonManager = GameObject.FindGameObjectWithTag("DungeonManager").GetComponent<DungeonManager>();
        switch(dungeonManager.dungeonName)
        {
            case "Plains":
                tilePrefab = Resources.Load<GameObject>("Tiles/Tile2").transform;
                break;
            case "Caves":
                tilePrefab = Resources.Load<GameObject>("Tiles/Tile1").transform;
                break;
            case "Chasm":
                tilePrefab = Resources.Load<GameObject>("Tiles/Tile3").transform;
                break;
        }

        generateFloor();
        //Debug.Log(numRooms);

        UpdateConnections();
    }
Exemplo n.º 35
0
    // Use this for initialization
    public virtual void Start()
    {
        selectionManager = GameObject.Find ("GameManager").GetComponent<SelectionManager>();
        dungeonManager = GameObject.Find ("GameManager").GetComponent<DungeonManager>();
        TipManager = GameObject.Find ("GameManager").GetComponent<TipManager>();
        player = GameObject.Find ("GameManager").GetComponent<Player>();
        spriteRender = this.gameObject.GetComponent<SpriteRenderer>();
        animator = this.gameObject.GetComponent<Animator>();
        //animator.enabled = false;  //atempt to turn off animations when not needed

        if(pathToPrefab.Length > 0)
            parentAnimationPrefab (pathToPrefab);

        //if(childAnimationPrefab != null)

        particleSystem.renderer.sortingLayerName = "Foreground";
        setImage(backImage);

        transform.name = this.GetType().Name;
        audio = GameObject.Find("FXController").GetComponent<AudioController>();
    }
Exemplo n.º 36
0
    void Start()
    {
        rooms = new int[7,7];
        spawnEnemies = manager.GetComponent<SpawnEnemies>();

        dungeonManager = GameObject.FindGameObjectWithTag("DungeonManager").GetComponent<DungeonManager>();

        generateFloor();
        //Debug.Log(numRooms);

        UpdateConnections();
    }