コード例 #1
0
    void LoadProperties()
    {
        GameObject wiredMesh = Resources.Load("Wired") as GameObject;

        theMeshes[0] = wiredMesh.GetComponent <MeshFilter>().sharedMesh; //wiredMesh.sharedMesh; //

        GameObject reinforcedMesh = Resources.Load("Reinforced") as GameObject;

        theMeshes[1] = reinforcedMesh.GetComponent <MeshFilter>().sharedMesh; //reinforcedMesh.sharedMesh;//

        GameObject smokeMesh = Resources.Load("Smoke") as GameObject;

        theMeshes[2] = smokeMesh.GetComponent <MeshFilter>().sharedMesh; //smokeMesh.sharedMesh; //

        theMaterials[0] = Resources.Load("WiredMat") as Material;
        theMaterials[1] = Resources.Load("ReinforcedMat") as Material;
        theMaterials[2] = Resources.Load("SmokeMat") as Material;

        theTraps[0]             = new WiredCase();
        theTraps[0].theMesh     = theMeshes[0];
        theTraps[0].theMaterial = theMaterials[0];

        theTraps[1]             = new ReinforcedCase();
        theTraps[1].theMesh     = theMeshes[1];
        theTraps[1].theMaterial = theMaterials[1];

        theTraps[2]             = new SmokeBomb();
        theTraps[2].theMesh     = theMeshes[2];
        theTraps[2].theMaterial = theMaterials[2];

        //theObjectives = emptyObjectives.GetComponentsInChildren<Objective>();
        // theRooms = emptyRooms.GetComponentsInChildren<RoomScript>();

        for (int i = 0; i < theRooms.Length; i++)
        {
            theRooms[i].roomTag = i;
            //securityBoxes.Add(theRooms[i].securityBox);
        }

        for (int i = 0; i < theObjectives.Length; i++)
        {
            if (theObjectives[i].objTrapType != TrapTypes.NO_TRAP)
            {
                theObjectives[i].trapID = i;
                theObjectives[i].SetUpTrap(theTraps[(int)theObjectives[i].objTrapType]);
            }
        }
    }
コード例 #2
0
    private void SpawnSmokeScreenPlayer(GameObject smokeBomb)
    {
        SmokeBomb smokeScreenInstance = GameObject.Instantiate(smokeScreenPrefab, smokeBomb.transform.position, smokeBomb.transform.rotation).GetComponent <SmokeBomb>();

        smokeScreenInstance.OnPlayerCollision();
    }