Inheritance: MonoBehaviour
Example #1
0
 void OnEnable()
 {
     if (!PM)
     {
         PM = GetComponent <player_movement>();
     }
 }
 /*public GameObject powerupTimerPanel;
  * public GameObject magnetTimerPanel;*/
 // Start is called before the first frame update
 void Start()
 {
     magnetTimer      = magnetTotalTimer;
     gm               = GameObject.FindWithTag("GameController").GetComponent <gamaManager>();
     pm               = GameObject.FindWithTag("Player").GetComponent <player_movement>();
     magnetTimerImage = pm.magnetTimerImage;
 }
Example #3
0
 private void Start()
 {
     staminaBar            = gameObject.transform;
     Anchor                = transform.Find("Anchor");
     player                = GameObject.Find("player");
     player_movementScript = player.GetComponent <player_movement>();
 }
Example #4
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = true;

            GameObject.Find("RestartButton").GetComponent <Image>().enabled    = true;
            GameObject.Find("TextRestartButton").GetComponent <Text>().enabled = true;

            player_movement score = GameObject.Find("Player").GetComponent <player_movement>();
            moodSwitch      scene = GameObject.Find("moodIndicator").GetComponent <moodSwitch>();
            Time.timeScale = 0;

            if (score.count < scene.angryPoints)
            {
                SceneManager.LoadScene("badEnding");
                //endText.text = "Try and humiliate the knight more!";
            }
            else if (score.count > scene.angryPoints)
            {
                SceneManager.LoadScene("goodEnding");
                //endText.text = "Close but you can do better!";
            }

            /*else if (score.count >= 800)
             * {
             *  endText.text = "You showed him who is boss!";
             * }*/
            //GameObject.Find("YouWin").GetComponent<Text>().enabled = true;
        }
    }
Example #5
0
 void Awake()
 {
     myHealth         = GetComponent <health>();
     myPlayerShoot    = GetComponent <player_shoot>();
     myPlayerMovement = GetComponent <player_movement>();
     myAnimator       = GetComponent <Animator>();
 }
Example #6
0
    // Start is called before the first frame update
    void Start()
    {
        puzzle   = GetComponent <Puzzle>();
        pm       = GameObject.Find("InputManager").GetComponent <player_movement>();
        animator = GetComponent <Animator>();

        values = RandomizeValues();
        while (CanWin(values))
        {
            values = RandomizeValues();
        }

        vials = new List <GameObject> {
            GameObject.FindGameObjectWithTag("Vial0"),
            GameObject.FindGameObjectWithTag("Vial1"),
            GameObject.FindGameObjectWithTag("Vial2"),
        };

        vialContainers = new List <GameObject> {
            GameObject.FindGameObjectWithTag("VialContainer0"),
            GameObject.FindGameObjectWithTag("VialContainer1"),
            GameObject.FindGameObjectWithTag("VialContainer2"),
        };

        UpdateMesh();
    }
Example #7
0
 void Start()
 {
     if (!PM)
     {
         PM = GetComponent <player_movement>();
     }
 }
Example #8
0
 void countDownTimer()
 {
     if (countDownStartValue > 0)
     {
         TimeSpan spanTime = TimeSpan.FromSeconds(countDownStartValue);
         timerUI.text = spanTime.Minutes + " : " + spanTime.Seconds;
         //Debug.Log("Timer: " + countDownStartValue);
         //timer wordt met 1 verlaagt.
         countDownStartValue--;
         //Na 1 seconde wordt de functie opnieuw aangeroepen.
         Invoke("countDownTimer", 1.0f);
     }
     else
     {
         //Debug.Log("UNHIDE!");
         Cursor.lockState = CursorLockMode.None;
         Cursor.visible   = true;
         //cameraScript cursor = GameObject.Find("Main Camera").GetComponent<cameraScript>();
         //cursor.lockCursor = false;
         //zet het spel stil
         Time.timeScale = 0;
         //haalt de huidige score op uit het mainCharacter object
         player_movement highScore = GameObject.Find("Player").GetComponent <player_movement>();
         timerUI.text = "Game Over!";
         GameObject.Find("TimeOver").GetComponent <Text>().enabled      = true;
         GameObject.Find("TimeOverBord").GetComponent <Image>().enabled = true;
         //Debug.Log("Game Over!");
         //Maakt de highscore text en de restartknop zichtbaar.
         GameObject.Find("FinalScoreText").GetComponent <Text>().enabled    = true;
         GameObject.Find("RestartButton").GetComponent <Image>().enabled    = true;
         GameObject.Find("TextRestartButton").GetComponent <Text>().enabled = true;
         //Hier wordt de highscore text bepaald.
         FinalScoreText.text = "Highscore: " + highScore.count;
     }
 }
Example #9
0
 // Use this for initialization
 void Start()
 {
     scorepoints        = 0;
     timeLeft           = 180.0f;
     pm                 = GameObject.FindWithTag("Player").GetComponent <player_movement>();
     m_text             = this.gameObject.transform.GetChild(0).GetComponent <Text>();
     content.fillAmount = 0.4f;
 }
 // Start is called before the first frame update
 void Start()
 {
     myRB         = GetComponent <Rigidbody2D>();
     thePlayer    = FindObjectOfType <player_movement>();
     currentIndex = 0;
     currentPS    = patrolSpots[currentIndex];
     isPatrol     = true;
 }
Example #11
0
 // Start is called before the first frame update
 void Start()
 {
     moveSpeed = 5f;
     //Get knight and player script reference.
     the_knight = GameObject.Find("Knight");
     knight_s   = (knight_script)the_knight.GetComponent(typeof(knight_script));
     the_player = GameObject.Find("Player");
     player_s   = (player_movement)the_player.GetComponent(typeof(player_movement));
 }
 void Awake()
 {
     myPlayerMovement = GetComponent <player_movement>();
     myHealth         = GetComponent <health>();
     myAnimator       = GetComponent <Animator>();
     GameMaster       = GameObject.Find("GameMaster");
     fireRateTimer    = 0f;
     grenadeTimer     = 0f;
 }
Example #13
0
    private void Start()
    {
        PlayerObject = GameObject.FindGameObjectWithTag("Player").GetComponent <player_movement>();
        DContainer   = GameObject.FindGameObjectWithTag("DeployableContainer").GetComponent <DeployAbleSaveManager>();



        //Buildpoint.GetComponent<SpriteRenderer>().sprite = GetItemSprite(ourItem); -this doesnt look that good
    }
Example #14
0
 // Use this for initialization
 void Start()
 {
     //Fetch the Material from the Renderer of the GameObject
     m_Material       = GetComponent <Renderer>().material;
     m_Material.color = Color.red;
     color_tag        = "Red";
     movement_script  = GetComponent <player_movement>();
     audio_script     = GetComponent <Audio_script>();
 }
Example #15
0
    // Start is called before the first frame update
    void Start()
    {
        thePlayer = FindObjectOfType <player_movement>();

        if (thePlayer.getStartPoint() == pointName)
        {
            thePlayer.transform.position = transform.position;
        }
    }
Example #16
0
    //public Text score2;
    //public Text score3;
    //public Text score4;
    //public Text score5;

    private void Awake()
    {
        scoreValue   = FindObjectOfType <PlayerStatistics>();
        toCanvases   = FindObjectOfType <MainMenuOptions>();
        playerIsDead = FindObjectOfType <PlayerHealthManager>();
        cameraD      = FindObjectOfType <camera_control>();
        playerD      = FindObjectOfType <player_movement>();
        managerD     = FindObjectOfType <UiManager>();
        sfxmanagerD  = FindObjectOfType <SFXManager>();
    }
Example #17
0
 // Use this for initialization
 void Start()
 {
     thePlayer = FindObjectOfType <player_movement>();
     if (thePlayer.StartPoint == PointName)
     {
         thePlayer.transform.position = transform.position;
         StartDirection               = new Vector2(0f, -1f);
         thePlayer.lastMove           = StartDirection;
         theCamera                    = FindObjectOfType <camera_control>();
         theCamera.transform.position = new Vector3(transform.position.x, transform.position.y, theCamera.transform.position.z);
     }
 }
Example #18
0
    // Start is called before the first frame update
    void OnTriggerEnter(Collider other)
    {
        player_movement target = GameObject.Find("Player").GetComponent <player_movement>();

        if (other.gameObject.tag == "Points")
        {
            Debug.Log("PUNTEN!!!");
            target.count = target.count + 100;
            target.SetCountText();
            target.script.SetImage();
        }
    }
Example #19
0
    // Start is called before the first frame update
    void Start()
    {
        //animators = new Animator[3];
        s_t           = new Transform[3];
        switch_timers = new float[3];
        for (int i = 0; i < 3; i++)
        {
            switch_timers[i] = 0.0f;
        }
        switches = new bool[3];
        for (int i = 0; i < 3; i++)
        {
            switches[i] = false;
        }
        switch_done = new bool[3];
        for (int i = 0; i < 3; i++)
        {
            switch_done[i] = false;
        }
        selected = 1;

        foreach (Transform t in transform)
        {
            foreach (Transform tt in t)
            {
                if (tt.gameObject.name == "Lever1")
                {
                    //animators[0] = tt.gameObject.GetComponent<Animator>();
                    s_t[0] = tt;
                }
                if (tt.gameObject.name == "Lever2")
                {
                    //animators[1] = tt.gameObject.GetComponent<Animator>();
                    s_t[1] = tt;
                }
                if (tt.gameObject.name == "Lever3")
                {
                    //animators[2] = tt.gameObject.GetComponent<Animator>();
                    s_t[2] = tt;
                }
                if (tt.gameObject.name == "Bar")
                {
                    bar = tt.gameObject.GetComponent <Transform>();
                }
            }
        }
        bar.localScale = new Vector3(0.0f, 1.0f, 1.0f);

        pm       = GameObject.Find("InputManager").GetComponent <player_movement>();
        puzzle   = GetComponent <Puzzle>();
        selected = 0;
    }
Example #20
0
    void OnTriggerEnter(Collider other)
    {
        Debug.Log("Hallo?");
        player_movement target = GameObject.Find("Player").GetComponent <player_movement>();

        /*  if (other.gameObject.tag == "PointsGround")
         * {
         *    Debug.Log("PUNTEN!!!");
         *    target.count = target.count + 100;
         *    target.SetCountText ();
         *    target.script.SetImage();
         * }*/
    }
Example #21
0
    /// <summary>
    /// Find the player's rigidBody for replay purposes, and check if we should run a replay
    /// </summary>
    private void Start()
    {
        player_movement playerMovement = FindObjectOfType <player_movement>();

        rbPlayer = playerMovement.gameObject.GetComponent <Rigidbody>();

        //Check if there are commands in the log
        if (CommandLog.commands.Count >= 1)
        {                                       //Commands in the log, run the replay
            bIsReplaying = true;
            playerMovement.bIsReplaying = true; //Prevent the player from issuing new commands during replay
        }
    }
Example #22
0
    // Start is called before the first frame update
    void Start()
    {
        player = FindObjectOfType <player_movement>();

        if (textFile != null)
        {
            textLines = (textFile.text.Split('\n'));
        }

        if (endAtLine == 0)
        {
            endAtLine = textLines.Length - 1;
        }
    }
Example #23
0
 // Start is called before the first frame update
 void Start()
 {
     pm     = GameObject.Find("InputManager").GetComponent <player_movement>();
     puzzle = GetComponent <Puzzle>();
     //animator = GetComponent<Animator>();
     foreach (Transform t in transform)
     {
         if (t.gameObject.name == "Needle")
         {
             needle = t;
         }
         if (t.gameObject.name == "Cylinder.022")
         {
             animator = t.GetComponent <Animator>();
         }
     }
     pressure = 0.5f;
 }
Example #24
0
    void Start()
    {
        if (instance != null)
        {
            DestroyObject(this.gameObject);
            return;
        }

        instance = this;
        this.pm  = this.GetComponent <player_movement>();
        this.sr  = this.GetComponent <SpriteRenderer>();

        this.go_glass = new GameObject("glass");
        this.go_glass.transform.SetParent(this.transform);
        {
            var sr = this.go_glass.AddComponent <SpriteRenderer>();
            sr.sprite           = sprite_manager.instance.glass;
            sr.sortingLayerName = "foreground";
        }

        this.go_rim = new GameObject("rim");
        this.go_rim.transform.SetParent(this.transform);
        {
            var sr = go_rim.AddComponent <SpriteRenderer>();
            sr.sprite           = sprite_manager.instance.glass_rim;
            sr.sortingLayerName = "background";
            sr.sortingOrder     = 100;
        }

        this.set_glass_height();

        this.go_shadow = new GameObject("shadow");
        this.go_shadow.transform.position = new Vector3(0.0f, -0.09f);
        this.go_shadow.transform.SetParent(this.transform);
        {
            this.sr_shadow                  = go_shadow.AddComponent <SpriteRenderer>();
            this.sr_shadow.sprite           = sprite_manager.instance.glass_shadow;
            this.sr_shadow.sortingLayerName = "background";
            this.sr_shadow.sortingOrder     = 99;
        }

        this.set_shadow();
    }
Example #25
0
    public void SetImage()
    {
        player_movement currentScore = GameObject.Find("Player").GetComponent <player_movement>();

        if (currentScore.count < neutralPoints)
        {
            Debug.Log("SMUG");
            myImageComponent.sprite = moodSmug;
        }
        else if (currentScore.count >= neutralPoints && currentScore.count < angryPoints)
        {
            Debug.Log("NEUTRAL");
            myImageComponent.sprite = moodNeutral;
        }
        else if (currentScore.count >= angryPoints)
        {
            Debug.Log("ANGRY");
            myImageComponent.sprite = moodAngry;
        }
    }
Example #26
0
 private void Start()
 {
     playerScript = player.GetComponent <player_movement>();
 }
Example #27
0
 // Use this for initialization
 void Start()
 {
     ThePlayer = FindObjectOfType <player_movement>();
 }
Example #28
0
 private void Awake()
 {
     regenDelay = FindObjectOfType <player_movement>();
 }
Example #29
0
 private void Start()
 {
     thePlayer = FindObjectOfType <player_movement>();
 }
 // Use this for initialization
 void Start()
 {
     movement_script = GetComponent <player_movement>();
 }