예제 #1
0
 void Start()
 {
     playerHealth   = GameObject.Find("Player").GetComponent <PlayerHealth>();
     ammoShotgun    = GameObject.Find("shotgun").GetComponent <ShotgunScript>();
     ammoUzi        = GameObject.Find("uzi").GetComponent <UziScript>();
     playerTf       = GameObject.Find("Player").GetComponent <Transform>();
     victoryTrigger = GameObject.Find("Victory Detector").GetComponent <VictoryTrigger>();
     gs             = gameState.playing;
     ws             = weaponSwitchingState.shotgun;
 }
예제 #2
0
    void handleHole(Transform t)
    {
        MeshRenderer mr = t.GetComponent <MeshRenderer>();

        if (mr)
        {
            //mr.material = (Material)Resources.Load("defaultMatX");
        }

        MeshCollider meshCollider = t.GetComponent <MeshCollider>();

        if (meshCollider == null)
        {
            meshCollider = t.gameObject.AddComponent <MeshCollider>();
        }

        if (meshCollider)
        {
            meshCollider.gameObject.layer = 10;
            meshCollider.material         = (PhysicMaterial)Resources.Load("PhysicMaterial/Goal");
        }
        BoxCollider boxCollider = t.GetComponent <BoxCollider>();

        if (boxCollider == null)
        {
            boxCollider = t.gameObject.AddComponent <BoxCollider>();
        }

        if (boxCollider)
        {
            Vector3 center = boxCollider.center;
            center.y             -= 0.01f;
            boxCollider.center    = center;
            boxCollider.isTrigger = true;
        }
        VictoryTrigger vt = t.GetComponent <VictoryTrigger>();

        if (vt == null)
        {
            t.gameObject.AddComponent <VictoryTrigger>();
        }
    }