示例#1
0
    private int damageRadius; //Varies for missiles & Exp Shells



    //****************
    void Awake()
    {
        GameObject tempObject   = GameObject.Find("PlayerCamera");
        Camera     playerCamera = tempObject.GetComponent <Camera>(); //

        sfx = tempObject.GetComponent <FXManager>();                  //

        tempObject   = GameObject.Find("A_Scene_Manager");
        SceneManager = tempObject.GetComponent <ScriptASceneManager>();
    }
示例#2
0
    //-------------------
    // AWAKE
    //-------------------
    void Awake()
    {
        pointsValue = 1500;

        armour = 5; // subtracted from any hit damage values this enemy may receive



        bulletXY    = new Vector3[4]; //for 4 BARRELS:  offsets on the end of the turret Gun: 2x2 grid
        bulletXY[0] = new Vector3(0, 0, 0);
        bulletXY[1] = new Vector3(0, 0, 0);
        bulletXY[2] = new Vector3(0, 0, 0);
        bulletXY[3] = new Vector3(0, 0, 0);


        turretZOffset = 0f; // Makes Missile appear on end of 'barrel' Z and not from its pivot point



        state = mode.passive;

        attackRadius = 350;
        blindRadius  = 100; // Switches off the targeting if too close

        GameObject tempObject = GameObject.Find("GunView");

        target = tempObject.transform;

        tempObject   = GameObject.Find("PlayerCamera");
        playerCamera = tempObject.GetComponent <Camera>();    //
        sfx          = tempObject.GetComponent <FXManager>(); //

        //Find and get INPUT MANAGER SCRIPT - Totally necessary :)
        tempObject = GameObject.Find("A_GameWrapper");
        inp        = tempObject.GetComponent <ScriptAInputManager>(); //

        tempObject         = GameObject.Find("A_Scene_Manager");
        sceneManagerScript = tempObject.GetComponent <ScriptASceneManager>(); // Access to 'LEVEL DATA[]'  file necessary

        // NGUI LABELS POOL
        tempObject   = GameObject.Find("A_Null_Labels");
        pointsScript = tempObject.GetComponent <ScriptPointsManager>();


        // Get Turret hinge
        for (int i = 0; i < transform.childCount; i++)
        {
            Transform c = transform.GetChild(i); if (c.name == "turntable")
            {
                hinge = c;
            }
        }
        // Get turret
        //for (int i = 0; i < hinge.transform.childCount; i++) { Transform c = hinge.transform.GetChild(i); if (c.name == "gun") { turret = c; } }
    }
示例#3
0
    //-------------------
    // AWAKE
    //-------------------
    void Awake()
    {
        pointsValue = 850;

        armour = 15; // subtracted from any hit damage values this enemy may receive


        state = mode.passive;

        attackRadius = 260;

        blindRadius = 70; // Switches off the targeting if too close

        GameObject tempObject = GameObject.Find("GunView");

        target = tempObject.transform;

        tempObject   = GameObject.Find("PlayerCamera");
        playerCamera = tempObject.GetComponent <Camera>();    //
        sfx          = tempObject.GetComponent <FXManager>(); //

        //Find and get INPUT MANAGER SCRIPT - Totally necessary :)
        tempObject = GameObject.Find("A_GameWrapper");
        inp        = tempObject.GetComponent <ScriptAInputManager>(); //

        tempObject         = GameObject.Find("A_Scene_Manager");
        sceneManagerScript = tempObject.GetComponent <ScriptASceneManager>(); // Access to 'LEVEL DATA[]'  file necessary

        // NGUI LABELS POOL
        tempObject   = GameObject.Find("A_Null_Labels");
        pointsScript = tempObject.GetComponent <ScriptPointsManager>();


        // Get Turret hinge
        for (int i = 0; i < transform.childCount; i++)
        {
            Transform c = transform.GetChild(i); if (c.name == "turret")
            {
                hinge = c;
            }
        }
        if (hinge)
        {
            for (int i = 0; i < hinge.transform.childCount; i++)
            {
                Transform c = hinge.transform.GetChild(i); if (c.name == "gun")
                {
                    turret = c;
                }
            }
        }
    }
    //-------------------
    // AWAKE
    //-------------------
    void Awake()
    {
        pointsValue = 15000;

        armour = 45; // subtracted from any hit damage values this enemy may receive


        state = mode.passive;

        attackRadius = 260;

        GameObject tempObject = GameObject.Find("GunView");

        target = tempObject.transform;

        tempObject   = GameObject.Find("PlayerCamera");
        playerCamera = tempObject.GetComponent <Camera>();    //
        sfx          = tempObject.GetComponent <FXManager>(); //

        //Find and get INPUT MANAGER SCRIPT - Totally necessary :)
        tempObject = GameObject.Find("A_GameWrapper");
        inp        = tempObject.GetComponent <ScriptAInputManager>(); //

        tempObject         = GameObject.Find("A_Scene_Manager");
        sceneManagerScript = tempObject.GetComponent <ScriptASceneManager>(); // Access to 'LEVEL DATA[]'  file necessary

        // NGUI LABELS POOL
        tempObject   = GameObject.Find("A_Null_Labels");
        pointsScript = tempObject.GetComponent <ScriptPointsManager>();

        Transform temp = null;

        for (int i = 0; i < transform.childCount; i++)
        {
            Transform c = transform.GetChild(i); if (c.name == "comms")
            {
                temp = c;
            }
        }
        // Get turret
        for (int i = 0; i < temp.transform.childCount; i++)
        {
            Transform c = temp.transform.GetChild(i); if (c.name == "hinge")
            {
                hinge = c;
            }
        }
    }
示例#5
0
    //-------------------
    // PREFAB FINDER
    //-------------------


    void Get_Prefab_Pointers()
    {
        GameObject tempObject = GameObject.Find("A_Scene_Manager");

        sceneManagerScript = tempObject.GetComponent <ScriptASceneManager>(); // Access to 'LEVEL DATA[]'  file necessary


        //Find and get INPUT MANAGER SCRIPT - Totally necessary :)
        tempObject = GameObject.Find("A_GameWrapper");
        inp        = tempObject.GetComponent <ScriptAInputManager>(); //

        tempObject = GameObject.Find("PlayerCamera");
        Camera playerCamera = tempObject.GetComponent <Camera>(); //

        sfx = tempObject.GetComponent <FXManager>();              // Sound and particles

        // NGUI LABELS POOL
        tempObject   = GameObject.Find("A_Null_Labels");
        pointsScript = tempObject.GetComponent <ScriptPointsManager>();

        //pre = tempObject.GetComponent<ScriptASceneManager>();

        //for (int i = 0; i < pre.objectPoolList.Length; i++)
        //{
        // Assign Default projectile for this enemy to Shoot
        //if (pre.objectPoolList[i].name == "bulletTracer") { projectile = pre.objectPoolList[i]; }
        // Basic Thrust Particle Effect to be added to the missile so find a reference in the object pool and assign it
        //if (pre.objectPoolList[i].name == "P_fx_thrust01") { fx = pre.objectPoolList[i]; }
        //}


        //-------------------
        // Find Spawn positions for bullet sparks on Player's helicopter
        gunView = GameObject.Find("innerA").transform; // for 'Quickly' lining up bullets with end of barrel - Use as Muzzle flash too

        i = 0;
        for (i = 0; i < gunView.transform.childCount; i++)
        {
            Transform c  = gunView.transform.GetChild(i);
            string    st = c.name;
            //if (st.Contains("spp")) { Destroy(c.renderer); Mesh mesh = c.GetComponent<MeshFilter>().mesh; DestroyImmediate(mesh); Debug.Log("found!"); }
            if (st.Contains("spp"))
            {
                sparkList.Add(c);
            }
        }
    }
示例#6
0
    //-------------------
    // AWAKE
    //-------------------
    void Awake()
    {
        pointsValue = 850;

        armour = 15; // subtracted from any hit damage values this enemy may receive


        state = mode.passive;

        attackRadius = 260;

        GameObject tempObject = GameObject.Find("GunView");

        target = tempObject.transform;

        tempObject   = GameObject.Find("PlayerCamera");
        playerCamera = tempObject.GetComponent <Camera>();    //
        sfx          = tempObject.GetComponent <FXManager>(); //

        //Find and get INPUT MANAGER SCRIPT - Totally necessary :)
        tempObject = GameObject.Find("A_GameWrapper");
        inp        = tempObject.GetComponent <ScriptAInputManager>(); //

        tempObject         = GameObject.Find("A_Scene_Manager");
        sceneManagerScript = tempObject.GetComponent <ScriptASceneManager>(); // Access to 'LEVEL DATA[]'  file necessary

        // NGUI LABELS POOL
        tempObject   = GameObject.Find("A_Null_Labels");
        pointsScript = tempObject.GetComponent <ScriptPointsManager>();


        // Get Turret hinge

        for (int i = 0; i < transform.childCount; i++)
        {
            Transform c = transform.GetChild(i); if (c.name == "BladesFrontSpinning")
            {
                c.renderer.enabled = false;
            }
        }
        for (int i = 0; i < transform.childCount; i++)
        {
            Transform c = transform.GetChild(i); if (c.name == "BladesBackSpinning")
            {
                c.renderer.enabled = false;
            }
        }

        for (int i = 0; i < transform.childCount; i++)
        {
            Transform c = transform.GetChild(i); if (c.name == "BladesFrontStill")
            {
                fRotor = c;
            }
        }
        for (int i = 0; i < transform.childCount; i++)
        {
            Transform c = transform.GetChild(i); if (c.name == "BladesBackStill")
            {
                bRotor = c;
            }
        }
    }
    //--------------------------------------------------------
    // Use this for initialization
    //--------------------------------------------------------
    //GameObject cube;
    void Awake()
    {
        //cube = GameObject.CreatePrimitive(PrimitiveType.Cube);

        layerMask = 1 << 13; // Terrain layer hits only



        //  DontDestroyOnLoad (transform.gameObject);// KEEP CAMERA AND ALL CHILDREN THROUGH OUT GAME CYCLE

        //  CAMERA HAS A FRUSTRUM CHILD ATTACHED as a mesh so i can use the verts to calculate waht objects are in view
        foreach (Transform child in transform)
        {
            //For fadeScreens
            //if(child.name == "blackScreen") { blackScreen = child; child.renderer.enabled = true; blackScreenOn = true; break; }

            if (child.name == "cameraFrustrum_prefabs")
            {
                foreach (Transform c in child.transform)
                {
                    frustrum        = c;
                    frustrum.parent = null;
                    frustrum.parent = transform;

                    Destroy(child.gameObject); //Debug.Log(" Found Camera Frustrum");

                    Mesh      mesh     = frustrum.GetComponent <MeshFilter>().mesh;
                    Vector3[] vertices = mesh.vertices;
                    FrustrumView = new Vector2[vertices.Length]; //this remains static
                    camView      = new Vector2[vertices.Length]; // this will be updated

                    int i = 0;
                    while (i < vertices.Length)
                    {
                        //Add verts to camera frustrum custom array
                        FrustrumView[i].x = vertices[i].x;
                        FrustrumView[i].y = vertices[i].z; // Convert the vector2 Y to the vector3 Z
                        //Debug.Log(" Verts: " + FrustrumView[i]);
                        i++;
                    }

                    //c.renderer.enabled = false;
                    Destroy(c.gameObject);

                    // REORDER VERTS TO SEQUENTIAL;
                    i = 0;

                    while (i < FrustrumView.Length)
                    {
                        if (i == 0)
                        {
                            camView[i].x = FrustrumView[0].x; camView[i].y = FrustrumView[0].y;
                        }
                        if (i == 1)
                        {
                            camView[i].x = FrustrumView[3].x; camView[i].y = FrustrumView[3].y;
                        }
                        if (i == 2)
                        {
                            camView[i].x = FrustrumView[1].x; camView[i].y = FrustrumView[1].y;
                        }
                        if (i == 3)
                        {
                            camView[i].x = FrustrumView[2].x; camView[i].y = FrustrumView[2].y;
                        }

                        i++;
                    }

                    FrustrumView = camView;
                    camView      = null;
                    camView      = new Vector2[vertices.Length]; // this will be updated
                    //i = 0;
                    //  while (i < FrustrumView.Length)
                    // {

                    //Debug.Log(" Verts " + i + ": " + FrustrumView[i] );

                    // i++;

                    //  }
                }
            }
        }

        //Find and get INPUT MANAGER SCRIPT - Totally necessary :)
        tempObject = GameObject.Find("A_GameWrapper");
        inp        = tempObject.GetComponent <ScriptAInputManager> (); //

        tempObject = GameObject.Find("A_Scene_Manager");
        asm        = tempObject.GetComponent <ScriptASceneManager>(); //

        tempObject = null;

        Set_Fog();
    }