Inheritance: MonoBehaviour
Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     Background     = (Texture)Resources.Load("TutorialMenu/Previews/" + MainMenuGUI.selectedGameName);
     PlayButton     = (Texture)Resources.Load("MenuCommon/play_" + MainMenuGUI.selectedGameName);
     MainMenuButton = (Texture)Resources.Load("MenuCommon/home_" + MainMenuGUI.selectedGameName);
     audioSource    = (AudioScript)GameObject.FindObjectOfType(typeof(AudioScript));
 }
Exemplo n.º 2
0
    void Start()
    {
        objectState = "Selected";

        changePossible = false;

        objectCollider = GetComponent <BoxCollider2D>();
        manager        = FindObjectOfType <MainSceneManager>();

        objectSprite = GetComponent <SpriteRenderer>();

        audioScript = FindObjectOfType <AudioScript>();


        if (objectCell)
        {
            transform.position = objectCell.transform.position;
            objectState        = "Waiting";
        }
        else
        {
            transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            GetComponent <SpriteRenderer>().sortingOrder = 51;
        }
    }
Exemplo n.º 3
0
    public void initAttack(Vector3 enemy, GameObject parent, float damage, bool handleOffset)
    {
        ///////////TODO: These could/should be in Awake() instead
        transform.position   = new Vector3(transform.position.x, transform.position.y + Tuner.DEFAULT_PROJECTILE_OFFSET, transform.position.y / 100.0f + 800.0f);
        transform.localScale = new Vector3(50f, 50f, 0); //TODO: Fix this
        Destroy(gameObject, Tuner.DEFAULT_PROJECTILE_RANGE / Tuner.DEFAULT_PROJECTILE_VELOCITY);
        AutoLayerSort sorter = gameObject.AddComponent <AutoLayerSort>();

        sorter.autoUpdate = true;
        ///////////
        FMODUnity.RuntimeManager.PlayOneShot("event:/sfx/attack_bow", AudioScript.get3DAudioPositionVector3(transform.position)); //TODO: Fix this

        castLocation = enemy;
        setParent(parent);
        ownerTag    = parent.tag;
        this.damage = damage;

        if (handleOffset)
        {
            castLocation.y += Tuner.DEFAULT_PROJECTILE_OFFSET;
        }

        dir = Ellipse.isometricDirection(castLocation, transform.position);

        transform.Rotate(new Vector3(0, 0, Mathf.Atan2(castLocation.y - transform.position.y, castLocation.x - transform.position.x) * 180f / Mathf.PI + 90f));
        transform.position = new Vector3(transform.position.x, transform.position.y, (transform.position.y - Tuner.DEFAULT_PROJECTILE_OFFSET) / 100.0f + 800.0f);
    }
Exemplo n.º 4
0
 void Awake()
 {
     soundManager    = GameObject.FindObjectOfType <SoundManager>();
     audioScript     = GameObject.FindObjectOfType <AudioScript>();
     timeDayFunction = GameObject.FindObjectOfType <TimeDayFunction>();
     movimiento      = GameObject.FindObjectOfType <Movimiento>();
 }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetAxisRaw("Fire1") != 0f &&
            ability2 && m_isAxisInUse == false &&
            (Time.realtimeSinceStartup - laser_timer >= seconds_between_laser))
        {
            laser_timer = Time.realtimeSinceStartup;
            GameObject instant = Instantiate(laser);
            instant.transform.position = transform.position + transform.right * 0.75f;
            instant.transform.up       = transform.right;
            AudioScript.PlaySound("laser");
            m_isAxisInUse = true;
        }
        if (Input.GetAxisRaw("Fire1") == 0f)
        {
            m_isAxisInUse = false;
        }

        anim.SetInteger("State", (int)player_state);

        if (transform.rotation.eulerAngles.z > 90.0F && transform.rotation.eulerAngles.z < 270F)
        {
            sprite.flipY = true;
        }
        else if (transform.rotation.eulerAngles.z < 90.0F && transform.rotation.eulerAngles.z > -90.0F)
        {
            sprite.flipY = false;
        }
        GetInput();
        ChangeState();
    }
Exemplo n.º 6
0
 public void q7YesClick()
 {
     q7.SetActive(false);
     q8.SetActive(true);
     choices[2]++;
     AudioScript.playClick();
 }
Exemplo n.º 7
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "enemy")
        {
            //Check if player fire animation going on
            if (playerAnim.GetCurrentAnimatorStateInfo(0).IsName("Fire") || playerAnim.GetCurrentAnimatorStateInfo(0).IsName("RunFire"))
            {
                //Get enemy object and destory
                GameObject enemy = other.transform.gameObject;
                enemy.tag = "deadenemy";
                enemy.GetComponent <Animator>().SetTrigger("dead");

                //Remove Box Collider did this so player can pass through the enemy after dead
                Destroy(enemy.GetComponent <BoxCollider>(), 0.5f);

                //Destroy Enemy
                Destroy(enemy, 1.0f);

                //Player is not underattack anymore
                GameLogic.isPlayerUnderAttack = false;

                //Play Shoot Particle on sword
                gameObject.transform.Find("Particle").GetComponent <ParticleSystem>().Play();

                //Player Dead Sound
                AudioScript.enemyHitSoundPlay();

                //Enemies left Count
                GameLogic.enemiesLeft--;
            }
        }
    }
Exemplo n.º 8
0
    // Use this for initialization
    void Awake()
    {
        blockGrid      = new GameObject[towerWidth, towerHeight];
        currentHeights = new int[6] {
            0, 0, 0, 0, 0, 0
        };
        audioManager = new GameObject().AddComponent <AudioScript>();

        Camera.main.transform.position = new Vector3(2.5f, 7f, -10f);
        Camera.main.orthographic       = true;
        Camera.main.orthographicSize   = 7.5f;

        highScoreManager = gameObject.AddComponent <HighScoreScript>();

        initializeBlockWell();

        initializeBlockPair();

        initializeDestroyBlock();

        initializeScoreText();

        initializeAlertText();

        flashPermanentAlert("Press ENTER to begin.");

        debugPointsPerLevel = new int[100];
    }
Exemplo n.º 9
0
    private void HandleMovement(float horizontal)
    {
        if (!myAnimator.GetBool("slide") && (isGrounded || airControl))
        {
            myRigidbody.velocity = new Vector2(horizontal * movementSpeed, myRigidbody.velocity.y);             //x=-1,y=0
            myAnimator.SetFloat("speed", Mathf.Abs(horizontal));
        }


        if (IsGrounded() && jump)
        {
            isGrounded = false;
            myRigidbody.AddForce(new Vector2(0, 500));
            myAnimator.SetTrigger("jump");
            myAnimator.SetBool("land", true);

            AudioScript.PlaySound("jump");
        }
        if (slide && !this.myAnimator.GetCurrentAnimatorStateInfo(0).IsName("Slide"))
        {
            myAnimator.SetBool("slide", true);
        }
        else if (!this.myAnimator.GetCurrentAnimatorStateInfo(0).IsName("Slide"))
        {
            myAnimator.SetBool("slide", false);
        }
    }
Exemplo n.º 10
0
 public void q11YesClick()
 {
     q11.SetActive(false);
     q12.SetActive(true);
     choices[3]++;
     AudioScript.playClick();
 }
Exemplo n.º 11
0
    void Start()
    {
        audioScript = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <AudioScript>();
        audioSource = gameObject.GetComponent <AudioSource>();
        rb          = GetComponent <Rigidbody>();
        //speed = 6;
        if (nascarCar)
        {
            speed = 20;
            i     = Random.Range(0, 30);
            if (i < 1)
            {
                acceleration = 0.00015f;
                maxSpeed     = 20.14f;
                baseDamage   = 0.6f;
            }
            else
            {
                baseDamage   = 10;
                acceleration = Random.Range(0.024f, 0.026f);
            }
        }
        else
        {
            acceleration = Random.Range(0.02f, 0.05f);
        }
        swerweAmount = Random.Range(minSwerweAmount, maxSwerweAmount);
        MaterialPropertyBlock _propBlock = new MaterialPropertyBlock();

        Renderer[] rend = this.gameObject.GetComponentsInChildren <Renderer>();
        rend[0].GetPropertyBlock(_propBlock);
        _propBlock.SetColor("_Color", Random.ColorHSV());
        rend[0].SetPropertyBlock(_propBlock);
    }
Exemplo n.º 12
0
 void OnEnable()
 {
     Audio = GameObject.Find("AudioManager").GetComponent <AudioScript>();
     Game  = gameObject.GetComponent <GameManager>();
     //The lowercase gameObject is intentional. It refers to the object this script is attached to
     SceneManager.sceneLoaded += OnSceneLoaded;
 }
Exemplo n.º 13
0
    private void OnTriggerStay(Collider other)
    {
        if (other.gameObject.tag == "wall")
        {
            other.GetComponent <WallBehavior>().Health -= damage;
            AudioScript.PlaySound(wallSound);
            Destroy(gameObject);
        }

        else if (other.gameObject.tag == "perfectTrap" && perfectTrapCheck)
        {
            int trapIndex = other.GetComponent <TrapIndex>().TrappuIndex;
            Debug.Log(trapIndex);
            PlayTrapSound(trapIndex);
            FindObjectOfType <ScoreManager>().ScoreChange(score * 2);
            Instantiate(blueParticles, gameObject.transform.position, blueParticles.transform.rotation);
            Destroy(gameObject);
            hasBeenHitThisFrame = true;
        }
        else if (other.gameObject.tag == "trap" && !perfectTrapCheck)
        {
            int trapIndex = other.GetComponent <TrapIndex>().TrappuIndex;
            Debug.Log(trapIndex);
            PlayTrapSound(trapIndex);
            FindObjectOfType <ScoreManager>().ScoreChange(score);
            Instantiate(yellowParticles, gameObject.transform.position, yellowParticles.transform.rotation);
            Destroy(gameObject);
            hasBeenHitThisFrame = true;
        }
    }
Exemplo n.º 14
0
 public void q3YesClick()
 {
     q3.SetActive(false);
     q4.SetActive(true);
     choices[0]++;
     AudioScript.playClick();
 }
Exemplo n.º 15
0
    void Awake()
    {
        audioListener         = GetComponent <AudioListener>();
        audioListener.enabled = false;
        camera            = transform.Find("SpaceCamera").GetComponent <Camera>();
        hudCamera         = GameObject.FindWithTag("HUD_Camera").GetComponent <Camera>();
        hudCameraAnimator = hudCamera.gameObject.GetComponent <AnimatorScript>();
        renderCameraPanel = GameObject.FindWithTag("RenderCameraImage").GetComponent <Image>();
        renderCamera      = Camera.main;

        rigidbody       = gameObject.GetComponent <Rigidbody>();
        audioScript     = gameObject.GetComponent <AudioScript>();
        scriptNoiseTest = gameObject.GetComponent <NoiseTest>();

        Application.targetFrameRate = desiredFrameRate;

        renderCameraMaterial            = renderCameraPanel.material;
        hudCameraTexture                = new RenderTexture(1920, 1080, 0, RenderTextureFormat.Default, 0);
        spaceCameraTexture              = new RenderTexture(1920, 1080, 0, RenderTextureFormat.Default, 0);
        hudCameraTexture.antiAliasing   = 2;
        spaceCameraTexture.antiAliasing = 2;
        hudCamera.targetTexture         = hudCameraTexture;
        camera.targetTexture            = spaceCameraTexture;

        if (GameObject.FindWithTag("MainMenuCamera") != null)
        {
            //renderCameraMaterial.SetFloat("_Fade", 0);
        }
        else
        {
            StartGame();
        }
    }
Exemplo n.º 16
0
    private void Start()
    {
        audioScript = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <AudioScript>();
        playerSpawns.AddRange(GameObject.FindGameObjectsWithTag("playerSpawn"));
        sceneLoader = gameObject.GetComponent <SceneLoader>();
        //startMenu = GameObject.Find("Menu2");
        startMenu.SetActive(true);

        if (SceneManager.GetActiveScene().name != "JoiningScene")
        {
            if (StatHolder.HowManyPlayers == 0)
            {
                //This if statement exists for developing purposes. It ensures that the player spawns work even if you dont start at menu
                StatHolder.HowManyPlayers = 2;
            }
            if (SceneManager.GetActiveScene().name == "Menu")
            {
                StatHolder.HowManyPlayers = 0;
            }
            playersForRound();
        }
        if (weaponSpawns.Count > 0)
        {
            StartCoroutine(SpawnWeapon());
        }
    }
Exemplo n.º 17
0
    // Use this for initialization
    void Start()
    {
        OtherData.s_setScript = this;

        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("SetScript_hotfix", "Start"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.SetScript_hotfix", "Start", null, null);
            return;
        }

        m_sliderMusic.value = AudioScript.getAudioScript().getMusicVolume();
        m_sliderSound.value = AudioScript.getAudioScript().getSoundVolume();

        if (m_isFromGameLayer)
        {
            m_button_qiehuanzhanghao.transform.localScale = new Vector3(0, 0, 0);
            m_button_tuichu.transform.localScale          = new Vector3(0, 0, 0);
            m_button_guanyu.transform.localScale          = new Vector3(0, 0, 0);
        }

        if (OtherData.s_channelName.CompareTo("ios") == 0)
        {
            m_button_qiehuanzhanghao.transform.localPosition = new Vector3(-180, -154.36f, 0);
            m_button_tuichu.transform.localScale             = new Vector3(0, 0, 0);
            m_button_guanyu.transform.localPosition          = new Vector3(180, -154.36f, 0);
        }

        m_text_VersionCode.text = OtherData.s_apkVersion;
    }
Exemplo n.º 18
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "player")
        {
            if (gameObject.transform.tag == "coin")
            {
                //set coin tag taken
                gameObject.tag = "cointaken";

                //Play Coin Sound
                AudioScript.coinSoundPlay();

                //Coin counter less
                GameLogic.coinsLeft--;

                //Set Total Score
                GameLogic.totalScore += 1;

                //Save Score
                int totalCoins = PlayerPrefs.GetInt("TotalCoins");
                totalCoins += 1;
                PlayerPrefs.SetInt("TotalCoins", totalCoins);

                //Play Particle
                gameObject.transform.Find("CoinParticle").GetComponent <ParticleSystem>().Play();

                //Destroy Coins
                GetComponent <MeshRenderer>().enabled = false;
                Destroy(gameObject, 1.0f);
            }
        }
    }
Exemplo n.º 19
0
    public void EndBattle(bool win, int exp)
    {
        transitionUI.SetActive(false);
        transitionUI.SetActive(true);
        AudioScript audioScript = new AudioScript();

        StartCoroutine(audioScript.FadeOut(battleAudio, 0.3f));
        StartCoroutine(audioScript.FadeIn(exploreAudio, 0.3f));
        battleTransition.SetActive(false);
        battleSystem.gameObject.SetActive(false);
        mainCamera.gameObject.SetActive(true);
        state = GameState.FreeRoam;
        if (win)
        {
            //TODO: SHOW EXP PROGRESS

            PlayerStat.exp += exp;

            if (PlayerStat.exp >= PlayerStat.maxExp)
            {
                state = GameState.Status;
                LevelUp();
                PlayerStat.maxExp += 15;
                PlayerStat.exp     = 0;
                OpenStat();
            }
        }
        else
        {
            //Game Over
            gameOverPanel.SetActive(true);
            state = GameState.GameOver;
        }
    }
Exemplo n.º 20
0
    // Use this for initialization
    void Start()
    {
        Messenger.AddListener <GameObject> ("exitObstacle", exitedCollider);
        Messenger.AddListener <GameObject> ("disappear", disappearObstacle);
        Messenger.AddListener <GameObject> ("enteredObstacle", enteredCollider);
        Messenger.AddListener("clearOutLane", clearOutLane);
        Messenger.AddListener("ranOutOfHealth", ranOutOfHealth);
        Messenger.AddListener("landed", landed);
        Messenger.AddListener("jumped", jumped);
        Messenger.AddListener <bool> ("isLaneEnabled", laneEnabled);
        Messenger.AddListener("hitPowerBox", hitPowerBox);
        cam               = Camera.main;
        scoreController   = new ScoreController();
        timerController   = new TimerController(() => TimesUp());
        cameraScript      = cam.GetComponent <CameraScript> ();
        bounds            = CameraExtensions.OrthographicBounds(cam);
        audioScript       = GameObject.FindGameObjectWithTag("AudioController").GetComponent <AudioScript> ();
        soundEffectScript = GameObject.FindGameObjectWithTag("SoundEffectsController").GetComponent <SoundEffectsScript> ();

        currentGameLevel = LevelManager.Instance.getCurrentLevelDetail();
        timerController.beginTimer(currentGameLevel.lengthInSeconds * 1000);
                #if UNITY_ANDROID
        touch = new TouchGesture(this.gestureSetting);
        StartCoroutine(touch.CheckHorizontalSwipes(
                           onLeftSwipe: () => { moveRight(); },
                           onRightSwipe: () => { moveLeft(); }
                           ));
                #endif
    }
Exemplo n.º 21
0
    // Use this for initialization
    void Start()
    {
        audioScript               = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <AudioScript>();
        LevelCam                  = GameObject.FindWithTag("MainCamera").GetComponent <MultiTargetCamera>();
        StatHolder.CurrentMode    = StatHolder.Modes.DM;
        StatHolder.HowManyPlayers = 0;
        StatHolder.Player1Wins    = 0;
        StatHolder.Player2Wins    = 0;
        StatHolder.Player3Wins    = 0;
        StatHolder.Player4Wins    = 0;
        StatHolder.TeamRedWins    = 0;
        StatHolder.TeamBlueWins   = 0;
        StatHolder.WinsNeeded     = 0;
        StatHolder.RoundNumber    = 0;
        StatHolder.Player1Color   = 100;
        StatHolder.Player2Color   = 100;
        StatHolder.Player3Color   = 100;
        StatHolder.Player4Color   = 100;

        roundManager = GameObject.Find("GameManager1").GetComponent <RoundManager>();
        audioScript.PlaySceneMusic(0);

        votes = new List <int>();
        votes.Add(0);
        votes.Add(0);
    }
Exemplo n.º 22
0
 public void q12YesClick()
 {
     q12.SetActive(false);
     choices[3]++;
     SceneManager.LoadScene("CharacterSheet");
     AudioScript.playClick();
 }
Exemplo n.º 23
0
    private IEnumerator Begin()
    {
        AudioScript.PlaySound(beginGame);
        yield return(new WaitForSeconds(2));

        SceneManager.LoadScene(1);
    }
Exemplo n.º 24
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "coin")
        {
            gm.coinCollected();
            AudioScript.PlaySound("coin");
            Destroy(other.gameObject);
        }
        if (other.tag == "life")
        {
            AudioScript.PlaySound("jump");
            Destroy(other.gameObject);
        }
        if (other.tag == "endLevel")
        {
            StartCoroutine(coolDown());
        }
        if (other.tag == "die")
        {
            myAnimator.SetBool("die", true);
            lives--;

            if (lives > 0)
            {
                StartCoroutine(LateCall());
            }
            else
            {
            }
            AudioScript.PlaySound("jump");
            //Destroy (other.gameObject);
        }
    }
Exemplo n.º 25
0
    // Start is called before the first frame update


    void Start()
    {
        aud           = GameObject.FindGameObjectWithTag("Music").GetComponent <AudioScript>();
        soundFX       = GameObject.FindGameObjectWithTag("SoundEffects").GetComponent <SoundEffectsScript>();
        musicSlider   = transform.GetChild(1).GetComponent <Slider>();
        soundFXSlider = transform.GetChild(2).GetComponent <Slider>();
        dropdown      = transform.GetChild(3).GetComponent <TMP_Dropdown>();
        toggle        = transform.GetChild(4).GetComponent <Toggle>();

        musicSlider.SetValueWithoutNotify(AudioScript.musicVolume);
        soundFXSlider.SetValueWithoutNotify(SoundEffectsScript.soundEffectsVolume);
        toggle.isOn = Screen.fullScreen;

        resolutions = GetResolutions();
        dropdown.ClearOptions();
        List <string> options = new List <string>();
        int           currentResolutionsIndex = 0;

        for (int i = 0; i < resolutions.Count; i++)
        {
            string option = resolutions[i].width + " x " + resolutions[i].height;
            options.Add(option);
            if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height)
            {
                currentResolutionsIndex = i;
            }
        }
        dropdown.AddOptions(options);
        dropdown.value = currentResolutionsIndex;
        dropdown.RefreshShownValue();
    }
Exemplo n.º 26
0
    void Start()
    {
        playerAudioScript = GetComponent <AudioScript>();

        playerDamage = gameObject.GetComponentInChildren <Damage>();      // Used to check possible damage on head.
        groundCheck  = gameObject.GetComponentInChildren <GroundCheck>(); // Check for the ground from the wheel.
    }
Exemplo n.º 27
0
    /// <summary>
    /// Getting the components and initialize start and end positions
    /// </summary>
    void Start()
    {
        if (GameObject.Find("GravityManager") == null)
        {
            characterState = States.MovingForward;
        }
        girl.transform.GetComponent <AnimPigen>().setIdle();
        //girl = GameObject.FindGameObjectWithTag("Girl");

        //BoyAnim = GetComponent<Animator>();
        //animScript = GetComponent<AnimYmerdreng>();
        //girlAudio = girl.GetComponent<WwiseAudioScript>();
        girlAudio        = girl.GetComponent <AudioScript>();
        yoghurtDetection = transform.FindChild("YoghurtDetection").GetComponent <YoghurtDetection>();
        BFS bfs = new BFS();

        Path          = new Stack <BezierSpline>();
        Path          = bfs.findNearestFinalDestination(pathSystem.bezierSplines[0]);
        currentSpline = Path.Pop();

        transform.position = currentSpline.GetPoint(0);
        transform.root.LookAt(transform.position + currentSpline.GetDirection(0));

        GetComponent <NoteSpawner>().Init();

        characterState = States.StartLevel;
        PlayerTracking();
    }
Exemplo n.º 28
0
    public void loseStamina(int staminaLoss)
    {
        AudioScript.playStaticSFX("_SFX/Battle sfx/miss/miss_1");
        GameObject DT = Instantiate(damageText);

        DT.GetComponent <DamageTextScript> ().speed = .075f;
        DT.transform.SetParent(CSUI.transform);
        DT.transform.position          = CSUI.transform.position;
        DT.transform.localScale        = new Vector3(1f, 1f, 1f);
        DT.GetComponent <Text> ().text = "-" + staminaLoss;

        this.Stamina -= staminaLoss;
        if (this.Stamina < 0)
        {
            this.Stamina = 0;
            this.dead    = true;
            if (this.tag == "Player")
            {
                gameObject.transform.eulerAngles = new Vector3(0f, 0f, 90f);
            }
            else
            {
                gameObject.transform.eulerAngles = new Vector3(0f, 0f, -90f);
            }
        }
    }
Exemplo n.º 29
0
 public void q6YesClick()
 {
     q6.SetActive(false);
     q7.SetActive(true);
     choices[1]++;
     AudioScript.playClick();
 }
Exemplo n.º 30
0
 public void q9YesClick()
 {
     q9.SetActive(false);
     q10.SetActive(true);
     choices[2]++;
     AudioScript.playClick();
 }
Exemplo n.º 31
0
	void init ()
	{
		menuList = new List<GameObject> ();
		foreach (Text t in selectMenu.GetComponentsInChildren<Text>()) {
			menuList.Add (t.gameObject);
			t.gameObject.GetComponent<TitleSelectMenu> ().SelectorImage.SetActive (false);
		}
		menuList.First().GetComponent<TitleSelectMenu>()
			.SelectorImage.SetActive(true);
        AS = GameObject.FindWithTag("Audio").GetComponent<AudioScript>();
    }
Exemplo n.º 32
0
    void Start()
    {
        HP = 5;
        SCORE = 0;
        Special_Gauge = 0;

        //おまじない一覧
        rb2d = GetComponent<Rigidbody2D>();//重力
        mannekenPisAnimator = GetComponent<Animator>();//小僧のアニメーター
        HBC = GameObject.FindWithTag("HealthBar").GetComponent<HealthBarController>();//体力バー関係
        AS = GameObject.FindWithTag("Audio").GetComponent<AudioScript>();
    }
Exemplo n.º 33
0
 void Awake()
 {
     if (instance)
     {
         Destroy (gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad (gameObject);
     }
 }
	void Awake ()
	{
		if (stageText == null) {
			stageText = gameObject.GetComponentsInChildren<Text> ()
				.Where(x => x.gameObject.name == "STAGE NAME")
				.Single();
		}

		currentStagePos = 0;
		stageLength = Stages.Count;
		stageText.text = Stages.First ();

        AS = GameObject.FindWithTag("Audio").GetComponent<AudioScript>();
    }
Exemplo n.º 35
0
    void Start()
    {
        audio = GetComponent<AudioScript>();

        // initialize start characters here
        currentDayNum = 1;
        nextDeathIn = 5;
        // TODO: replace with Constructor if Journal is no gameobject
        journal = FindObjectOfType<Journal>();
        journal.gameObject.SetActive(false);
        FindObjectOfType<InterfaceController>().HideRoomStats();

        List<string> playerNames = loadPlayerNames();

        selectedRoom = GameObject.Find("Start (2,3)").GetComponent<Room>();
        List<int> usedIndizes = new List<int>();

        for (int i = 0; i < 6; i++)
        {
            int randomInt = UnityEngine.Random.Range(0, playerNames.Count);
            Character testCharacter = Instantiate(character_prefab);
            testCharacter.CharName = playerNames[randomInt];
            playerNames.RemoveAt(randomInt);
            selectedRoom.Characters.Add(testCharacter);
            do
            {
                randomInt = UnityEngine.Random.Range(0, playerHeads.Length);
            } while (usedIndizes.Contains(randomInt));

            usedIndizes.Add(randomInt);
            testCharacter.Portrait = playerHeads[randomInt];
            testCharacter.Face = playerFaces[randomInt];
            characters.Add(testCharacter);
        }

        selectedRoom.drawPeople();

        foreach (Room i in FindObjectsOfType<Room>())
        {
            i.BlackSmog.SetActive(true);
            i.gameObject.SetActive(false);
        }

        selectedRoom.SelectBubble.SetActive(true);
        selectedRoom.discoverNeighbors();

        activeRooms.Add(selectedRoom);

        FindObjectOfType<InterfaceController>().SetRoomMembers(selectedRoom.Characters);
    }
Exemplo n.º 36
0
    void Awake()
    {
        if(_instance == null)
        {
            // If the first instance, make it singleton
            _instance = this;
            DontDestroyOnLoad(this);
        }
        else
        {
            // if it singleton already exists
            // destroy the other
            if(this != _instance)
                Destroy(this.gameObject);

        }
    }
Exemplo n.º 37
0
 // Use this for initialization
 void Start()
 {
     AS = GameObject.FindWithTag("Audio").GetComponent<AudioScript>();
     MP_B = Bullet_Prefab.GetComponent<MP_Bullet>();
 }
Exemplo n.º 38
0
 void Awake()
 {
     current = this;
 }
Exemplo n.º 39
0
 // Use this for initialization
 void Start()
 {
     MP = GameObject.FindWithTag("Player").GetComponent<Manekin_Pis>();
     HBC = GameObject.FindWithTag("HealthBar").GetComponent<HealthBarController>();//体力バー関係
     AS = GameObject.FindWithTag("Audio").GetComponent<AudioScript>();
 }