示例#1
0
        public static void BuildNewHelicopter()
        {
            //Create a new helicopter setup
            GameObject currentHeli = new GameObject("New Helicopter", typeof(HeliController));

            Selection.activeGameObject = currentHeli;


            //COG : Center of Gravity
            //Create the COG object for the helicopter
            GameObject curCOG = new GameObject("COG");

            curCOG.transform.SetParent(currentHeli.transform);

            HeliController currentController = currentHeli.GetComponent <HeliController>();

            //Assign the COG to the current helicopter
            currentController.COG = curCOG.transform;

            //Create Groups
            GameObject audioGroup     = new GameObject("Audio Group");
            GameObject graphicsGroup  = new GameObject("Graphics Group");
            GameObject collisionGroup = new GameObject("Collision Group");
            GameObject rotorsGroup    = new GameObject("Rotors Group");

            audioGroup.transform.SetParent(currentHeli.transform);
            graphicsGroup.transform.SetParent(currentHeli.transform);
            collisionGroup.transform.SetParent(currentHeli.transform);
            rotorsGroup.transform.SetParent(currentHeli.transform);
        }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        HeliController script = target as HeliController;

        if (GUILayout.Button("Auto Assign List"))
        {
            if (script.parentObject != null)
            {
                if (script.waypoints.Count > 0)
                {
                    script.waypoints.Clear();
                }

                int m_index = 0;
                foreach (Transform child in script.parentObject.transform)
                {
                    Waypoints temp = new Waypoints(m_index, child.gameObject);
                    script.waypoints.Add(temp);
                    m_index++;
                }
            }
            else
            {
                Debug.Log("Error Parent Cannot be null try assigning it and trying again");
            }
        }
    }
示例#3
0
文件: Gem.cs 项目: ksmai/games
    void OnTriggerEnter(Collider other)
    {
        HeliController hc = other.transform.parent.GetComponent <HeliController>();

        hc.PickupCoins(5);
        Destroy(gameObject);
    }
    private void OnTriggerExit(Collider other)
    {
        HeliController temp = other.gameObject.GetComponentInChildren <HeliController>();

        if (temp != null)
        {
            player = temp;
            player.IndicatorUpdate(IndicatorManager.signState.Arrow);
        }
    }
示例#5
0
    void OnTriggerExit(Collider other)
    {
        HeliController temp = other.gameObject.GetComponentInChildren <HeliController>();

        if (temp != null)
        {
            canAcceptMission = false;
            MissionController.HideMissionAcceptPanel();
        }
    }
示例#6
0
    void OnTriggerEnter(Collider other)
    {
        HeliController temp = other.gameObject.GetComponentInChildren <HeliController>();

        if (temp != null)
        {
            canAcceptMission = true;
            string bestTimeString = GetBestTimeString();
            MissionController.ShowMissionAcceptPanel(missionTitle, bestTimeString, missionDescription, idealHelicopter.ToString());
        }
    }
示例#7
0
    public override void Landed()
    {
        rb.useGravity = true;
        ps.Play();

        if (GameManager.instance.MissionComplete)
        {
            HeliController script = GameManager.instance.evacHeli.GetComponent <HeliController>();
            AudioManger.instance.Play("LZHot");
            script.PickUpPlayer(transform.position);
        }
    }
    private void OnCollisionEnter(Collision coll)
    {
        HeliController tempHC = coll.collider.gameObject.GetComponentInChildren <HeliController>();

        if (tempHC != null)
        {
            Debug.Log("tempHC before " + tempHC.transform.position);
            coll.collider.transform.position += coll.contacts[0].normal * -20.0f;
            Rigidbody rb = tempHC.GetComponentInParent <Rigidbody>();
            tempHC.GetComponent <HeliInput>().ZeroSpeed();
            rb.velocity = Vector3.zero;
            Debug.Log("tempHC after " + tempHC.transform.position);
            FMOD.Studio.EventInstance randomSound = SoundPicker();
            randomSound.start();
        }
    }
示例#9
0
 void UpdateCurrentCopter(int indexDelta)
 {
     MusicPlayer.instance.StopMusic();
     currentCopterIndex += indexDelta;
     if (currentCopterIndex >= copters.Length)
     {
         currentCopterIndex = 0;
     }
     if (currentCopterIndex < 0)
     {
         currentCopterIndex = copters.Length - 1;
     }
     for (int i = 0; i < copters.Length; i++)
     {
         copters[i].SetActive(i == currentCopterIndex);
         if (i == currentCopterIndex)
         {
             HeliController chopper = copters[i].transform.GetComponentInChildren <HeliController>();
             chopper.TakeInstance();
             chopper.ReportToMainCamera();
             MusicPlayer.instance.StartMusic();
         }
     }
 }
示例#10
0
 public void TakeInstance()
 {
     instance = this;
 }
示例#11
0
 protected virtual void Awake()
 {
     _heliControl = GetComponent <HeliController>();
 }