Exemple #1
0
        private void BuildSpline(LinearSpline spline, Vector3 startPosition, Vector3 pickupPosition, Vector3 dropoffPosition, Entity starportEntity, ContractEventData contractData)
        {
            spline.Start();
            KeyValuePair <int, Vector3> keyValuePair = new KeyValuePair <int, Vector3>(this.activeEffectsCount, dropoffPosition);

            this.activeEffectsCount++;
            Vector3    vector   = pickupPosition + new Vector3(0f, 12f, 0f);
            Quaternion rotation = Quaternion.LookRotation(vector - startPosition);

            spline.AddWayPoint(startPosition, rotation);
            Vector3 position = Vector3.Lerp(startPosition, vector, 0.6f);

            spline.AddWayPoint(position, rotation, 0.9f, 0f);
            position = Vector3.Lerp(startPosition, vector, 0.7f);
            spline.AddWayPoint(position, rotation, 0.8f, 0f);
            position = Vector3.Lerp(startPosition, vector, 0.8f);
            spline.AddWayPoint(position, rotation, 0.7f, 0f);
            position = Vector3.Lerp(startPosition, vector, 0.9f);
            spline.AddWayPoint(position, rotation, 0.6f, 0f);
            Quaternion rotation2 = Quaternion.LookRotation(TransportController.FACTORY_ORIENTATION);

            spline.AddWayPoint(vector, rotation2, 0.3f, 0f, new WaypointReached(this.ArrivingAtBuilding), null);
            spline.AddWayPoint(pickupPosition, rotation2, 0.3f, 2f, new WaypointReached(this.FactoryReached), contractData);
            Quaternion rotation3 = Quaternion.LookRotation(TransportController.FACTORY_ORIENTATION + new Vector3(0f, -0.2f, 0f));

            spline.AddWayPoint(vector + new Vector3(0f, -5f, 0f), rotation3, 0.25f, 0f);
            Vector3 vector2 = dropoffPosition + new Vector3(0f, 12f, 0f);
            Vector3 vector3 = vector2 - vector;

            vector3.Normalize();
            Quaternion rotation4 = Quaternion.LookRotation(vector3 + new Vector3(0f, -0.2f, 0f));

            spline.AddWayPoint(vector, rotation4, 0.7f, 0f);
            Vector3    position2 = Vector3.Lerp(vector, vector2, 0.2f);
            Quaternion rotation5 = Quaternion.LookRotation(vector3);

            spline.AddWayPoint(position2, rotation5, 0.8f, 0f);
            Vector3 position3 = Vector3.Lerp(vector, vector2, 0.3f);

            spline.AddWayPoint(position3, rotation5);
            position = Vector3.Lerp(vector, vector2, 0.6f);
            spline.AddWayPoint(position, rotation5, 0.8f, 0f);
            position = Vector3.Lerp(vector, vector2, 0.7f);
            spline.AddWayPoint(position, rotation5, 0.6f, 0f);
            position = Vector3.Lerp(vector, vector2, 0.8f);
            spline.AddWayPoint(position, rotation5, 0.5f, 0f);
            position = Vector3.Lerp(vector, vector2, 0.9f);
            spline.AddWayPoint(position, rotation5, 0.4f, 0f);
            rotation2 = Quaternion.LookRotation(TransportController.STARPORT_ORIENTATION);
            spline.AddWayPoint(vector2, rotation2, 0.3f, 0f, new WaypointReached(this.ArrivingAtBuilding), keyValuePair);
            spline.AddWayPoint(dropoffPosition, rotation2, 0.3f, 2f, new WaypointReached(this.StarportReached), new KeyValuePair <Entity, ContractEventData>(starportEntity, contractData));
            rotation3 = Quaternion.LookRotation(TransportController.STARPORT_ORIENTATION + new Vector3(0f, -0.2f, 0f));
            spline.AddWayPoint(vector2 + new Vector3(0f, -5f, 0f), rotation3, 0.25f, 0f);
            Vector3 vector4 = startPosition - vector2;

            vector4.Normalize();
            Quaternion rotation6 = Quaternion.LookRotation(vector4 + new Vector3(0f, -0.2f, 0f));

            spline.AddWayPoint(vector2, rotation6, 0.7f, 0f, new WaypointReached(this.UnloadEffects), keyValuePair);
            position2 = Vector3.Lerp(vector2, startPosition, 0.2f);
            Quaternion rotation7 = Quaternion.LookRotation(vector4);

            spline.AddWayPoint(position2, rotation7, 0.8f, 0f);
            position3 = Vector3.Lerp(vector2, startPosition, 0.3f);
            spline.AddWayPoint(position3, rotation7);
            spline.AddWayPoint(startPosition, rotation7);
        }