示例#1
0
    void Start()
    {
        Physics2D.IgnoreLayerCollision(11, 11);
        Physics2D.IgnoreLayerCollision(11, 13);
        Physics2D.IgnoreLayerCollision(12, 13);
        Physics2D.IgnoreLayerCollision(10, 13);

        PlayerPrefs.SetInt("points", 0);

        pacman   = GameObject.Find("Pacman").GetComponent <PacManScript>();
        ghost[0] = GameObject.Find("RedGost").GetComponent <GostControllerScript>();
        ghost[1] = GameObject.Find("PinkGost").GetComponent <GostControllerScript>();
        ghost[2] = GameObject.Find("LightBlueGost").GetComponent <GostControllerScript>();
        ghost[3] = GameObject.Find("YellowGost").GetComponent <GostControllerScript>();

        audioSource = GetComponent <AudioSource>();
        board       = GameObject.Find("Board");

        volumeOn.gameObject.SetActive(true);
        volumeOff.gameObject.SetActive(false);
        volumeOn.enabled  = true;
        volumeOff.enabled = false;

        init();
    }
示例#2
0
 private void Start()
 {
     pacman = GameObject.Find("Pacman").GetComponent <PacManScript>();
     rb     = GetComponent <Rigidbody2D>();
     gate   = GameObject.Find("Gate");
     initGhost();
     getOutOfHome = false;
 }
    void Start()
    {
        for (int i = 0; i < 4; i++)
        {
            ghostPoints[i].SetActive(false);
        }

        startPoint = transform.position;
        source     = GetComponent <AudioSource>();

        pacman             = GameObject.Find("Pacman").GetComponent <PacManScript>();
        gostAI             = GameObject.Find(transform.name).GetComponent <GostAI>();
        gostScript         = GameObject.Find(transform.name).GetComponent <GostScript>();
        gostGoHomeAIScript = GameObject.Find(transform.name).GetComponent <GhostGoHomeAIScript>();

        initGhost();
    }