예제 #1
0
        void Start()
        {
            winScreen.enabled = false;
            gliders           = new GameObject[numAI + 1];
            Glider glider = GameObject.Instantiate(gliderPrefab, start.position - start.forward * 20, start.rotation).GetComponent <Glider>();

            glider.setAgent(new PlayerAgent(glider));
            //glider.transform.Find("Main Camera").gameObject.SetActive(true);
            GameObject cam = GameObject.Instantiate(camPrefab, glider.transform.position, glider.transform.rotation);

            cam.GetComponent <CameraControl>().target = glider.transform;
            glider.indicator = indicator;
            glider.setRaceStats(SelectedRaceParameters.wingspan, SelectedRaceParameters.dragMultiplier, SelectedRaceParameters.mass, SelectedRaceParameters.controlAuthority);
            glider.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePosition;
            gliders[0] = glider.gameObject;

            float aiMinSpan = Mathf.Max(SelectedRaceParameters.wingspan, RaceStatsCalculator.MIN_WINGSPAN);
            float aiMaxSpan = Mathf.Min(SelectedRaceParameters.wingspan, RaceStatsCalculator.MAX_WINGSPAN);
            float aiMinDrag = Mathf.Max(SelectedRaceParameters.wingspan, RaceStatsCalculator.MIN_DRAG_MULT);
            float aiMaxDrag = Mathf.Min(SelectedRaceParameters.wingspan, RaceStatsCalculator.MAX_DRAG_MULT);
            float aiMinMass = Mathf.Max(SelectedRaceParameters.wingspan, RaceStatsCalculator.MIN_MASS);
            float aiMaxMass = Mathf.Min(SelectedRaceParameters.wingspan, RaceStatsCalculator.MAX_MASS);
            float aiMinCtrl = Mathf.Max(SelectedRaceParameters.wingspan, RaceStatsCalculator.MIN_AUTHORITY);
            float aiMaxCtrl = Mathf.Min(SelectedRaceParameters.wingspan, RaceStatsCalculator.MAX_AUTHORITY);

            for (int i = 0; i < numAI; i++)
            {
                glider = GameObject.Instantiate(gliderPrefab, start.position + start.right * (i + 1) * 3, start.rotation).GetComponent <Glider>();
                glider.setAgent(new AIAgent(glider, goal.position));
                glider.setRaceStats(Random.Range(aiMinSpan, aiMaxSpan), Random.Range(aiMinDrag, aiMaxDrag), Random.Range(aiMinMass, aiMaxMass), Random.Range(aiMinCtrl, aiMaxCtrl));
                glider.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePosition;
                gliders[i + 1] = glider.gameObject;
            }
        }
예제 #2
0
        public override void applySpecificEffect(Glider glider)
        {
            Rigidbody rb = glider.GetComponent <Rigidbody>();

            rb.velocity *= Vulture.BOOST_STRENGTH;
        }
예제 #3
0
        public void boost(Glider glider)
        {
            Rigidbody rb = glider.GetComponent <Rigidbody>();

            rb.velocity = rb.velocity + new Vector3(0, 1000 * Time.deltaTime, 0);
        }