상속: MonoBehaviour
예제 #1
0
    private void Awake()
    {
        levelScript = this;

        fadeInOut.SetActive(true);
        gameOverMenu.SetActive(false);
    }
예제 #2
0
파일: Item.cs 프로젝트: zarielan/Nocuous-v3
    public bool UseItem(LevelScript lvl, GameObject inthisroom)
    {
        bool allUsedUp = false;

        if (name == lvl.GetPrefabName(lvl.PF_FireExtinguisher))
        {
            Transform fire = inthisroom.transform.Find(lvl.GetPrefabName(lvl.PF_Fire));

            if (fire != null)
            {
                Destroy(fire.gameObject);
            }

            // Decrease extinguisher use here TODO
        }
        else if (name == lvl.GetPrefabName(lvl.PF_Plank))
        {
            Transform hole = inthisroom.transform.Find(lvl.GetPrefabName(lvl.PF_Hole));

            if (hole != null)
            {
                lvl.CreateElementInRoom(lvl.PF_PlankBridge, inthisroom);

                allUsedUp = true;
            }
        }

        return(allUsedUp);
    }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     parallax  = GameObject.Find("Parallax").GetComponent <Parallax>();
     script    = new LevelScript(levels[0]);
     lastLevel = script.level;
     endLevel  = new LevelScript(betweenLevels);
 }
예제 #4
0
 void Start()
 {
     _logObject   = GameObject.Find(StaticVariables.LogObjectName);
     _levelScript = GameObject.Find(StaticVariables.LevelObjectName).GetComponent <LevelScript>();
     _gameState   = GameObject.Find("GameScript").GetComponent <GameScript>().gameState;
     _apple       = _logObject != null?_logObject.transform.Find(StaticVariables.AppleObjectName) : null;
 }
예제 #5
0
 public static void AssignLevel(LevelScript level)
 {
     currentLevel = level;
     level.gameObject.SetActive(true);
     PlayerControls.goalScoreTextStatic.text = "" + currentLevel.targetSavedBlueberries;
     currentScore = 0;
 }
예제 #6
0
 public TileMap(LevelScript level, int x, int z)
 {
     this.Level = level;
     this.Map   = new TileScript[x, z];
     this.Size  = new Vector2(x, z);
     this.Tiles = new List <TileScript>();
 }
예제 #7
0
 public TileScript Init(LevelScript level, Position p)
 {
     this.Edges    = new Edge[4];
     this.level    = level;
     this.Position = new Position(p);
     return(this);
 }
예제 #8
0
    public override void OnInspectorGUI()
    {
        LevelScript myTarget = (LevelScript)target;

        myTarget.experience = EditorGUILayout.IntField("Experience", myTarget.experience);
        EditorGUILayout.LabelField("Level", myTarget.Level.ToString());
    }
예제 #9
0
    public void Navigate(int scene)
    {
        switch (scene)
        {
        case 0:     //menu

            m_desiredPosition = Vector3.zero;

            LevelScript ls = FindObjectOfType <LevelScript>();

            if (ls != null)
            {
                Destroy(ls.gameObject);
            }

            m_otherAudioSource.Stop();
            m_mainAudioSource.clip = m_menuSong;
            m_mainAudioSource.Play();

            break;

        case 1:                                                    //game
            m_desiredPosition = Vector3.left * leftMovementCanvas; //1280

            m_mainAudioSource.clip = m_gameSong;
            m_mainAudioSource.Play();
            break;

        case 2:     //collectables
            UpdateCollectableButtons();
            m_desiredPosition = Vector3.down * leftMovementCanvas;
            break;
        }
    }
    /// <summary>
    /// Initializes the tile with new data.
    /// </summary>
    /// <param name="diamonds">Number of diamonds in the tile.</param>
    /// <param name="xCoord">x-position in the grid for the tile.</param>
    /// <param name="yCoord">y-position in the grid for the tile.</param>
    /// <param name="inLevel">Reference to the level the tile is in.</param>
    public void Initialize(int diamonds, int xCoord, int yCoord, LevelScript inLevel)
    {
        // Attach hint FX
        var hintP = ObjectPooler.Instance.GetPooledObject(hintParticles.name);

        hintP.transform.SetParent(transform);
        hintP.transform.localPosition = new Vector3(0, fxOffset, 0);
        hintP.SetActive(true);
        hintFX = hintP.GetComponent <ParticleSystem>();

        // Attach explosion FX
        var explodeP = ObjectPooler.Instance.GetPooledObject(explodedParticles.name);

        explodeP.transform.SetParent(transform);
        explodeP.transform.localPosition = new Vector3(0, fxOffset, 0);
        explodeP.SetActive(true);
        explodeFX = explodeP.GetComponent <ChildParticleEmitter>();

        // Update variables
        numDiamonds = diamonds;
        clickable   = true;
        x           = xCoord;
        y           = yCoord;
        level       = inLevel;
    }
예제 #11
0
    //method called everytime when a new inspector is drawn inside Unity
    public override void OnInspectorGUI()
    {
        LevelScript myLevelScript = (LevelScript)target;

        myLevelScript.experience = EditorGUILayout.IntField("Experience", myLevelScript.experience); //any change done need to be written back
        EditorGUILayout.LabelField("Level", myLevelScript.Level.ToString());                         //read-only; label contronl requires a string value
    }
예제 #12
0
 void Awake()
 {
     masterGame = GetComponentInParent<MasterGameScript>();
     foreground = transform.Find ("Camera/Foreground");
     level = GetComponentInChildren<LevelScript>();
     waves = new List<Wave>();
 }
예제 #13
0
    void Awake()
    {
        //catapult = spring.connectedBody.transform;
        lerpScript = GameObject.Find("Main Camera").GetComponent<LerpObjectives>();
        projectileFollowScript = GameObject.Find("Main Camera").GetComponent<ProjectileFollow>();
        projectileFollowScript.projectile = transform;
        projectileFollowScript.script = this.gameObject.GetComponent<forceshooting>();
        projectileFollowScript.SetCameraToBallPosition();
        level = GameObject.Find("ScriptObject").GetComponent<LevelScript>();
        totalCheckpoints = level.totalCheckpoints;
        resetColliders = level.checkpoints;
        walls = level.walls;
        newBallPositions = level.ballPositions;
        newCatapultPositions = level.catapultPositions;
        force = level.force;
        level.ball = this.gameObject;

        createTrail = this.GetComponent<TrajectoryScript1>() as TrajectoryScript1;
        if(SceneManager.GetActiveScene().name == "DiscoveryClub")
        {
            if(projectileFollowScript.finishedTutorial == false)
            {
                finishedTutorial = false;
            }
            else
            {
                finishedTutorial = true;
            }
        }
    }
    public override void OnInspectorGUI()
    {
        LevelScript ls = (LevelScript)target;

        ls.exp = EditorGUILayout.IntField("Experience", ls.exp);
        EditorGUILayout.LabelField("Level", ls.Level.ToString());
    }
예제 #15
0
    private void FixedUpdate()
    {
        float v = CrossPlatformInputManager.GetAxis("Horizontal");

        GetComponent <Rigidbody2D>().velocity = new Vector2(v, 0) * _RacketSpeed;
        if (GameObject.FindGameObjectsWithTag("brick").Length == 0)
        {
            if (SceneManager.GetActiveScene().name == "Level36")
            {
                return;
            }
            else
            {
                Level = FindObjectOfType <LevelScript>();
                //Level.Pass();
                int currentLevel = SceneManager.GetActiveScene().buildIndex;

                if (currentLevel >= PlayerPrefs.GetInt("levelIsUnlocked"))
                {
                    PlayerPrefs.SetInt("levelIsUnlocked", currentLevel + 1);
                }

                Debug.Log("LEVEL" + PlayerPrefs.GetInt("levelIsUnlocked") + " UNLOCKED");
            }

            winPanel.SetActive(true);
            winSound.Play();
            Time.timeScale = 0;
            Debug.Log("You won");
        }
    }
예제 #16
0
 void Awake()
 {
     levelGenerator        = GameObject.Find(Tags.LEVEL_GENERATOR).GetComponent <LevelScript>();
     levelGeneratorPooling = GameObject.Find(Tags.LEVEL_GENERATOR).GetComponent <LevelGeneratorPooling>();
     shootBtn = GameObject.Find(Tags.SHOOT_BTN).GetComponent <Button>();
     shootBtn.onClick.AddListener(() => Fire());
 }
예제 #17
0
 void Awake()
 {
     FoundPuzzlePiece = false;
     _dialogueScript  = GameObject.FindGameObjectWithTag("UI").GetComponent <Dialogue>();
     //_interfaceScript = GameObject.FindGameObjectWithTag("UI").GetComponent<InterfaceScript>();
     _levelScript = GameObject.FindGameObjectWithTag("ScriptHolder").GetComponent <LevelScript>();
 }
예제 #18
0
 public void Awake()
 {
     //Get all of the scripts
     InteractionScript  = GetComponent <InteractionCommands>();
     CommandScript      = GetComponent <Commands>();
     CombatCommands     = GetComponent <CombatCommands>();
     MovementCommands   = GetComponent <MovementCommands>();
     DissectingScript   = GetComponent <DissectInputScript>();
     DialogueScript     = GameObject.FindGameObjectWithTag("UI").GetComponent <Dialogue>();
     PlayerScript       = GetComponent <Player>();
     InterfaceScript    = GameObject.FindGameObjectWithTag("UI").GetComponent <InterfaceScript>();
     ItemNameListScript = GameObject.FindGameObjectWithTag("ScriptHolder").GetComponent <ItemNameList>();
     GameTurnController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameTurnController>();
     if (!GameObject.FindGameObjectWithTag("CommandListHolder"))
     {
         Instantiate(gameObject, Vector3.zero, Quaternion.identity);
         gameObject.tag  = "CommandListHolder";
         gameObject.name = "CommandListHolder";
         gameObject.AddComponent <CommandList>();
         CommandListScript = gameObject.GetComponent <CommandList>();
     }
     else
     {
         CommandListScript = GameObject.FindGameObjectWithTag("CommandListHolder").GetComponent <CommandList>();
     }
     LevelScript = GameObject.FindGameObjectWithTag("ScriptHolder").GetComponent <LevelScript>();
 }
예제 #19
0
    public void Navigate(int scene)
    {
        switch (scene)
        {
        case 0:     //menu
            UpdateMenuButtons();

            m_desiredPosition = Vector3.zero;

            LevelScript ls = FindObjectOfType <LevelScript>();

            if (ls != null)
            {
                Destroy(ls.gameObject);
            }

            m_otherAudioSource.Stop();
            m_mainAudioSource.clip = m_menuSong;
            m_mainAudioSource.Play();

            break;

        case 1:     //game
            m_desiredPosition = Vector3.left * 1280;

            m_mainAudioSource.clip = m_gameSong;
            m_mainAudioSource.Play();
            break;
        }
    }
 void Awake()
 {
     _source = FindObjectOfType <AudioSource>();
     bsm     = new BearStateMachine();
     Reset();
     ls = FindObjectOfType <LevelScript>();
 }
예제 #21
0
 void Start()
 {
     level        = FindObjectOfType <LevelScript> ();
     FruitsEaten  = FindObjectsOfType <Fruits> ().ToList();
     GameStarted += Manager_GameStarted;
     notification = FindObjectOfType <Notification> ();
 }
예제 #22
0
 // Start is called before the first frame update
 void Start()
 {
     rigidBody2D     = GetComponent <Rigidbody2D>();
     playerAnimation = GetComponent <Animator>();
     respawnPoint    = transform.position;
     startPoint      = transform.position;
     levelscript     = FindObjectOfType <LevelScript>();
 }
예제 #23
0
 // Use this for initialization
 void Start()
 {
     animator         = GetComponent <Animator>();
     audioSource      = GetComponent <AudioSource>();
     LevelScript      = GetComponent <LevelScript>();
     audioSource.loop = false;
     ScoreText.text   = "SCORE  NEEDED TO  OPEN: " + MinimumScoreToActive.ToString();
 }
예제 #24
0
 // Start is called before the first frame update
 void Start()
 {
     level1 = Instantiate(Level1Prefab, Vector3.zero, Quaternion.identity).GetComponent <LevelScript>();
     level1.Load();
     level1.enabled = false;
     scoreText      = Score.GetComponentInChildren <Text>();
     MusicController.SoundController(MusicController.SOUNDS.MENU, true);
 }
 // Use this for initialization
 void Start()
 {
     levelScript = FindObjectOfType<LevelScript>();
     x = 0;
     y = INITIAL_DIRECTION;
     enemyRadius = GetComponent<CircleCollider2D>().radius;
     lastShotTime = -50;
 }
예제 #26
0
 private void Start()
 {
     Level = FindObjectOfType <LevelScript>();
     ThePlayer.transform.position = new Vector3(-Toolbox.TileSizeX / 2f, 0f, ThePlayer.transform.position.z);
     _caveHandler      = FindObjectOfType <CaveHandler>();
     _villageSequencer = GameObject.FindGameObjectWithTag("Scripts").AddComponent <VillageSequencer>();
     StartCoroutine("LoadSequence");
 }
예제 #27
0
 private void CountBreakableBlocks()
 {
     if (tag == "Breakable")
     {
         level = FindObjectOfType <LevelScript>();
         level.blockAdded();
     }
 }
예제 #28
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         LevelScript.OnFinish();
         FindObjectOfType <AudioManager>().Play("Win");
     }
 }
예제 #29
0
    LevelScript level;                        //instantiate Level type and as a reference

    private void Start()
    {
        level = FindObjectOfType <LevelScript>(); //assign level to be a level type

        if (tag == "Breakable")                   //only count blocks we can break
        {
            level.CountLevelBlocks();             //+1 to the number of breakable blocks //every block instance has this script so it should correctly count the number of blocks we can break in a level
        }
    }
예제 #30
0
 private void CountBreakableBlocks()
 {
     //Encontrar el objeto con el script
     level = FindObjectOfType <LevelScript>();
     if (tag == "Breakable")
     {
         level.CountBlocks();
     }
 }
예제 #31
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.name.StartsWith("Ball"))
     {
         Ball.complete = true;
         SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
         LevelScript.Pass();
     }
 }
예제 #32
0
    void Start()
    {
        gameManager = GameManager.singleton;
        level       = gameManager.level;
        speed       = level.speed;
        speed2      = level.speed2;

        InitializingBackground();
    }
예제 #33
0
 void Awake()
 {
     masterGame = GetComponentInParent<MasterGameScript>();
     foreground = transform.Find ("Camera/Foreground");
     playerCamera = GetComponentInChildren<Camera>();
     revengeSpawner = GetComponentInChildren<RevengeSpawner>();
     level = GetComponentInChildren<LevelScript>();
     waves = new List<Wave>();
 }
 // Start is called before the first frame update
 void Start()
 {
     _levelScript       = levelBaseGameObject.GetComponentInChildren <LevelScript>();
     _playerTransform   = this.GetComponent <Transform>();
     waypoints          = _levelScript.getWaypoints();
     transform.position = waypoints[(MenuScreenLoadParam.currentLevel - 1) * 3].position;
     currWaypointIdx    = (MenuScreenLoadParam.currentLevel - 1) * 3;
     currLoc            = MenuScreenLoadParam.currentLevel;
 }
예제 #35
0
 // Use this for initialization
 void Awake()
 {
     lScript = this;
     if (!PlayerPrefs.HasKey ("Played")) {
         PlayerPrefs.SetInt("Played",0);
     }
     curLevel=PlayerPrefs.GetInt("CurrentLevel");
     if ((PlayerPrefs.GetInt ("Played")) < curLevel)
         PlayerPrefs.SetInt ("Played", curLevel);
 }
예제 #36
0
	// Use this for initialization
	void Start () {
        Frame = Instantiate(Resources.Load("Prefab/Frame"), Vector3.zero, Quaternion.identity) as GameObject;
        Frame.transform.parent = gameObject.transform;
        Frame.SetActive(false);

        CameraControls = Camera.main.GetComponent<CameraController>();
        LS = this.gameObject.GetComponentInChildren<LevelScript>();
        NowClic = false;
        UICam = NGUITools.FindCameraForLayer(8);
       // Debug.Log(UICam.name);
	}
예제 #37
0
    public void Start()
    {
        InstantiatePlayer();
        _stars = new List<ShrinkStars>();
        _stars = FindObjectsOfType<ShrinkStars>().ToList<ShrinkStars>();
        Instance = this;
        _currentNumberOfLives = MaxNumberOfLives;

        if (Player == null)
        {
            Debug.LogError("Assign Player to LevelScript!");
            Application.Quit();
        }
    }
예제 #38
0
    void Awake()
    {
        rnd = new System.Random();
        GetComponent<TrailRenderer>().enabled = false;
        isBoosted = false;
        level = GameObject.Find("Level").GetComponent<LevelScript>();
        shootLogic = GetComponent<ShootLogicV3>();
        if (GameObject.Find("GameManager"))
        {
            manager = GameObject.Find("GameManager").GetComponent<GameManagerScript>();
            camShake = GameObject.Find("GameManager").GetComponent<CameraShakeScript>();
            cam = Camera.main;
        }

        amountOfHits = 0;

        anim = GetComponent<Animator>();
    }
예제 #39
0
    override protected void Start()
    {
        base.Start();

        levelScript = FindObjectOfType<LevelScript>();
        uiManager = FindObjectOfType<UIManagerScript>();

        ScriptRobot.Health = ScriptRobot.MaxHealth;

        (ScriptRobot.CharacterController as RobotController).AttackDelay = ScriptRobot.AttackDelay;
        (ScriptRobot.CharacterController as RobotController).JumpDelay = ScriptRobot.JumpDelay;

        characterShootingHeight = -0.1f;

        if (projectile)
        {
            projectile.ScriptProjectile = new Projectile(ScriptRobot.ShotsDamage, ScriptRobot.ShotsSpeed);
        }

        robotAnimator = GetComponent<Animator>();

    }
예제 #40
0
    /// <summary>
    /// Initializes the tile with new data.
    /// </summary>
    /// <param name="diamonds">Number of diamonds in the tile.</param>
    /// <param name="xCoord">x-position in the grid for the tile.</param>
    /// <param name="yCoord">y-position in the grid for the tile.</param>
    /// <param name="inLevel">Reference to the level the tile is in.</param>
    public void Initialize(int diamonds, int xCoord, int yCoord, LevelScript inLevel)
    {
        // Attach hint FX
        var hintP = ObjectPooler.Instance.GetPooledObject(hintParticles.name);
        hintP.transform.SetParent(transform);
        hintP.transform.localPosition = new Vector3(0, fxOffset, 0);
        hintP.SetActive(true);
        hintFX = hintP.GetComponent<ParticleSystem>();

        // Attach explosion FX
        var explodeP = ObjectPooler.Instance.GetPooledObject(explodedParticles.name);
        explodeP.transform.SetParent(transform);
        explodeP.transform.localPosition = new Vector3(0, fxOffset, 0);
        explodeP.SetActive(true);
        explodeFX = explodeP.GetComponent<ChildParticleEmitter>();

        // Update variables
        numDiamonds = diamonds;
        clickable = true;
        x = xCoord;
        y = yCoord;
        level = inLevel;
    }
예제 #41
0
    void Start()
    {
        objects = new List<GameObject>();

        planets = new GameObject[2];

        planets[0] = GameObject.Find("StartingPlanet");

        player = GameObject.Find("Player");

        camera = GameObject.Find("Main Camera");

        go = GameObject.Find("Canvas");

        leveldata = new LevelScript[levelCount];
        for (int i = 0; i < levelCount; ++i)
        {
            leveldata[i] = new LevelScript();
        }

        CreateLevelData ();

        persistentData = GameObject.Find("PersistentData").GetComponent<PersistentData>();

        currentLevel = persistentData.currentLevelID - 1;

        go.SetActive(false);

        planets[0].GetComponent<PlanetScript>().planetID = currentLevel;
        planets[0].GetComponent<Renderer>().material = planetMats[currentLevel % 5];

        BuildLevel();
    }
예제 #42
0
    public override void Start()
    {
        base.Start();

        level = (LevelScript) parentGame.GetComponentInChildren (typeof(LevelScript));
    }
예제 #43
0
파일: Goal.cs 프로젝트: TisLars/hit-it-hard
 void Awake()
 {
     ball = GameObject.Find("Ball").GetComponent<BallScript>();
     level = GameObject.Find("Level").GetComponent<LevelScript>();
 }
예제 #44
0
 void Awake()
 {
     level = GameObject.Find("Level").GetComponent<LevelScript>();
 }
예제 #45
0
	// Use this for initialization
	void Start ()
	{
	    script = GetComponent<LevelScript>();
        cameraScript = GameObject.Find("Main Camera").GetComponent<ProjectileFollow>();

	}