Ejemplo n.º 1
0
 void Start()
 {
     Top_Transform    = GetComponentInParent <Tank_ID_Control_CS> ().transform;
     RC_Camera_Script = FindObjectOfType <RC_Camera_CS> ();
     // Send message to "Turret_Horizontal" and "CrossHair".
     Top_Transform.BroadcastMessage("Get_Gun_Camera", This_Camera, SendMessageOptions.DontRequireReceiver);
 }
Ejemplo n.º 2
0
    void Awake()
    {
        this.tag                   = "MainCamera";
        this.name                  = "Main Camera";
        This_Camera                = GetComponent <Camera> ();
        This_Camera.enabled        = false;
        This_Camera.depth          = 0;
        This_Camera.cullingMask    = ~(1 << 8);          // Ignore CrossHair.
        This_Camera.nearClipPlane  = Clipping_Planes_Near;
        This_Camera.fieldOfView    = TPV_FOV;
        This_AudioListener         = GetComponent <AudioListener> ();
        This_AudioListener.enabled = false;
        //
        RC_Camera_CS RC_Camera_Script = FindObjectOfType <RC_Camera_CS> ();

        if (RC_Camera_Script)
        {
            RC_Camera_Flag = RC_Camera_Script.Flag;
        }
    }
    void Awake()
    {
        this.gameObject.name = "Game_Controller";          // This name is referred to by "Tank_ID_Control".
        this.tag             = "GameController";
        // Modify the Physics and Time manager.
        Initial_TimeScale = Time_Scale;
        Set_TimeScale();
        Physics.gravity        = new Vector3(0.0f, Gravity, 0.0f);
        Physics.sleepThreshold = 0.5f;
        Time.fixedDeltaTime    = Fixed_TimeStep;
        // Find RC_Camera.
        RC_Camera_Script = FindObjectOfType <RC_Camera_CS> ();
        // Count the number of tanks.
        int Operable_Count     = 0;
        int Not_Operable_Count = 0;
        int Friendly_Count     = 0;
        int Hostile_Count      = 0;

        Event_Controller_CS [] Temp_Event_Scripts = FindObjectsOfType <Event_Controller_CS> ();
        for (int i = 0; i < Temp_Event_Scripts.Length; i++)
        {
            if (Temp_Event_Scripts [i].Event_Type == 0)
            {
                if (Temp_Event_Scripts [i].Tank_ID != 0)
                {
                    Operable_Count += 1;
                }
                else
                {
                    Not_Operable_Count += 1;
                }
                if (Temp_Event_Scripts [i].Relationship == 0)
                {
                    Friendly_Count += 1;
                }
                else
                {
                    Hostile_Count += 1;
                }
            }
        }
        Tank_ID_Control_CS [] Temp_Top_Scripts = FindObjectsOfType <Tank_ID_Control_CS> ();
        for (int i = 0; i < Temp_Top_Scripts.Length; i++)
        {
            if (Temp_Top_Scripts [i].Tank_ID != 0)
            {
                Operable_Count += 1;
            }
            else
            {
                Not_Operable_Count += 1;
            }
            if (Temp_Top_Scripts [i].Relationship == 0)
            {
                Friendly_Count += 1;
            }
            else
            {
                Hostile_Count += 1;
            }
        }
        if (Operable_Count > 10)
        {
            Not_Operable_Count += Operable_Count - 10;
            Operable_Count      = 10;
        }
        //Debug.Log ( "Operable" + Operable_Count + "/" + "Not_Operable" + Not_Operable_Count + "::" + "Frinedly" + Friendly_Count + "/" + "Hostile" +  Hostile_Count ) ;
        Operable_Tanks           = new Transform [11];
        Not_Operable_Tanks       = new Transform [Not_Operable_Count];
        Max_Friendly_Num         = Friendly_Count;
        Max_Hostile_Num          = Hostile_Count;
        Friendly_Body_Transforms = new Transform [Max_Friendly_Num];
        Hostile_Body_Transforms  = new Transform [Max_Hostile_Num];
        Friendly_Body_Scripts    = new MainBody_Setting_CS [Max_Friendly_Num];
        Hostile_Body_Scripts     = new MainBody_Setting_CS [Max_Hostile_Num];
        Friendly_AI_Scripts      = new AI_CS [Max_Friendly_Num];
        Hostile_AI_Scripts       = new AI_CS [Max_Hostile_Num];
    }