Пример #1
0
 // Use this for initialization
 void Start()
 {
     topStuckCheck    = transform.Find("TopStuckCheck");
     leftStuckCheck   = transform.Find("LeftStuckCheck");
     rightStuckCheck  = transform.Find("RightStuckCheck");
     playerController = GetComponent <BoxyControl>();
 }
Пример #2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If the player enters the trigger zone...
        if (other.tag == "Player")
        {
            BoxyControl playerController = other.GetComponent <BoxyControl>();

            if (playerController.HandleGetCoin(color))
            {
                // Destroy me
                Destroy(gameObject);
            }
        }
    }
Пример #3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If the player enters the trigger zone...
        if (other.tag == "Player")
        {
            BoxyControl playerController = other.GetComponent <BoxyControl>();

            playerController.Die();

            // disable collision by destroying myself. Pretty hacky.
            if (hazardClass == HazardClass.Invisible)
            {
                Destroy(transform.root.gameObject);
            }
        }
    }
Пример #4
0
    public Transform player;                    // Reference to the player's transform.


    void Awake()
    {
        // Setting up the reference.
        playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <BoxyControl>();
        player           = GameObject.FindGameObjectWithTag("Player").transform;
    }