Example #1
0
    // Use this for initialization
    void Start()
    {
        player  = GameObject.FindGameObjectWithTag("Player");
        plyctrl = player.GetComponent <playercontrol>();

        distanceOffset = 1.5f;
    }
Example #2
0
 // Use this for initialization
 void Start()
 {
     distanceLimit = 3.5f;
     player        = GameObject.FindGameObjectWithTag("Player");
     plyctrl       = player.GetComponent <playercontrol>();
     canGiveSushi  = false;
 }
Example #3
0
    // Start is called before the first frame update
    void OnTriggerStay2D(Collider2D other)

    {
        playercontrol pc = other.GetComponent <playercontrol>();

        if (pc != null)
        {
            pc.ChangeHealth(-1);
        }
    }
Example #4
0
    void OnCollisionEnter2D(Collision2D other) //赋予碰撞检测属性

    {
        playercontrol pc = other.gameObject.GetComponent <playercontrol>();

        if (pc != null)
        {
            pc.ChangeHealth(-1);
        }
    }
Example #5
0
 void Start()
 {
     currentHealth   = fullHealth;
     controlMovement = GetComponent <playercontrol> ();
     // HUD initialization
     healthSlider.maxValue = fullHealth;
     healthSlider.value    = fullHealth;
     damaged  = false;
     playerAS = GetComponent <AudioSource> ();
 }
Example #6
0
    ///碰撞检测相关
    void OnTriggerEnter2D(Collider2D other)
    {
        playercontrol pc = other.gameObject.GetComponent <playercontrol>();

        if (pc != null)
        {
            if (pc.MyCurrentHealth < pc.MyMaxHealth)
            {
                pc.ChangeHealth(1);
                Instantiate(collectEffect, transform.position, Quaternion.identity);//生成特效
                Destroy(this.gameObject);
            }
        }
    }
Example #7
0
 // Start is called before the first frame update
 void Start()
 {
     playercontrolerscript = GameObject.Find("player").GetComponent <playercontrol>();
 }
Example #8
0
    // Use this for initialization
    void Start()
    {
        gameObject.name = m_playerName;
        transform.FindChild("body").gameObject.GetComponent <Renderer>().material.color = m_playerColor;



        playercontrl  = gameObject.GetComponentInChildren <playercontrol>();
        cameraTrans   = transform.FindChild("Camera");
        camera        = cameraTrans.GetComponent <Camera>();
        chat          = GetComponent <chatScript>();
        audioListener = cameraTrans.GetComponent <AudioListener>();
        fireCon       = gameObject.GetComponentInChildren <fireControl>();
        inputCol      = transform.FindChild("inputCollider").GetComponent <Collider>();
        networkPlayer = GetComponent <NetworkPlayer>();



        if (networkPlayer)
        {
            networkPlayer.playerName  = m_playerName;
            networkPlayer.playerColor = m_playerColor;
        }


        if (!isLocalPlayer)
        {
            if (chat)
            {
                chat.enabled = false;
            }

            if (playercontrl)
            {
                playercontrl.enabled = false;
            }

            if (camera)
            {
                camera.enabled = false;
            }

            if (audioListener)
            {
                audioListener.enabled = false;
            }

            if (inputCol)
            {
                inputCol.enabled = false;
            }

            if (fireCon)
            {
                fireCon.enabled = false;
            }
            if (networkPlayer)
            {
                networkPlayer.enabled = false;
            }
        }
    }
Example #9
0
 void Start()
 {
     playerControl = GetComponent <playercontrol>();
 }
Example #10
0
 // Use this for initialization
 void Start()
 {
     playercontrolref = transform.GetComponent<playercontrol>();
 }
Example #11
0
 void Start()
 {
     player_control = GameObject.FindGameObjectsWithTag("CurPlayer")[0].GetComponent <playercontrol>();
     DragonObject   = GameObject.FindGameObjectsWithTag("Dragon")[0].GetComponent <dragonAI>();
 }
Example #12
0
 // Start is called before the first frame update
 void Start()
 {
     playercontrolerscript = GameObject.Find("player").GetComponent <playercontrol>();
     InvokeRepeating("SpawnObstacle", startDalay, repeatRate);
 }