コード例 #1
0
    // Use this for initialization
    void Start()
    {
        GameObject player = GameObject.Find("player");

        playerStatus       = player.GetComponent <player_Status> ();
        playerController   = player.GetComponent <player_Controller> ();
        enemyPattern       = this.GetComponent <enemy_pattern> ();
        cheaterStatusLeft  = GameObject.Find("cheater_left").GetComponent <cheater_status> ();
        cheaterStatusRight = GameObject.Find("cheater_right").GetComponent <cheater_status> ();

        //gameoverPanel = GameObject.Find ("game_over_panel");
        //gameoverPanel.SetActive (false);
        //finalScore = GameObject.Find ("final_score_number").GetComponent<Text>();
    }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        player_Controller myPlayer = transform.root.GetComponent <player_Controller> ();

        if (Input.GetAxisRaw("Fire1") > 0 && nextBullet < Time.time && remainingRounds > 0)
        {
            nextBullet = Time.time + timeBetweenBullets;
            Vector3 rot;
            if (myPlayer.getFacing() == -1f)
            {
                rot = new Vector3(0, -90, 0);
            }
            else
            {
                rot = new Vector3(0, 90, 0);
            }
            Instantiate(projectile, transform.position, Quaternion.Euler(rot));

            playASound(shootSound);

            remainingRounds       -= 1;
            playerAmmoSlider.value = remainingRounds;
        }
    }
コード例 #3
0
 private void Start()
 {
     levelReference  = GameObject.FindWithTag("Level Data").GetComponent <Level_Data>();
     playerReference = GameObject.FindWithTag("Player").GetComponent <player_Controller>();
 }
コード例 #4
0
 // Start is called before the first frame update
 void Start()
 {
     gamePlayer = FindObjectOfType <player_Controller>();
 }