Пример #1
0
    void Awake()
    {
        if (Physics.gravity.y > -80f)
        {
            Physics.gravity = new Vector3(0, -100f, 0);
        }

        //Controller initalization
        allow_gamepad_camera_movement = true;
        allow_gamepad_player_movement = true;
        disable_left_joystick         = false;

        can_jump = true;

        if (use_camera_type_1 == false)
        {
            use_camera_type_1 = true;
        }

        if (booster_force == 0)
        {
            booster_force = 10f;
        }

        //Get camera
        if (camera_anchor == null)
        {
            camera_anchor = GameObject.Find("Camera Anchor");
        }

        //Get player rigidbody component
        if (player_rigidbody == null)
        {
            player_rigidbody = GetComponent <Rigidbody>();
        }

        //Get trail component
        if (dash_trail_renderer == null)
        {
            dash_trail_renderer = GetComponent <TrailRenderer>();
        }

        if (dash_trail_renderer.enabled == true)
        {
            dash_trail_renderer.enabled = false;
        }

        //Dash
        if (dash_speed == 0)
        {
            dash_speed = 80f;
        }

        if (dash_duration == 0)
        {
            dash_duration = 0.3f;
        }

        if (dash_trail_renderer == false)
        {
            dash_trail_renderer = GetComponent <TrailRenderer>();
        }

        //Create array in heap with 4 memory spaces of transform type
        checkpoints = new Transform[4];

        //For each checkpoint index check if there is something in it, else remind in the console that all of those indexes are not assigned
        for (int i = 1; i < 5; i++)
        {
            if (checkpoints[i - 1] == null)
            {
                checkpoints[i - 1] = GameObject.Find("checkpoint_" + i).transform;
            }
            else
            {
                Debug.LogError("please assign gameobject to " + checkpoints[i - 1]);
            }
        }
    }
Пример #2
0
 private void Awake()
 {
     _trail = GetComponent <TrailRenderer>();
 }
 public static Tween TweenEndColor(this TrailRenderer renderer, Color to, float duration) =>
 Tweening.To(getter: () => renderer.endColor,
             setter: endColor => renderer.endColor = endColor,
             to, duration).SetTarget(renderer);
Пример #4
0
 // Use this for initialization
 void Start()
 {
     boomerangTrail = gameObject.GetComponent <TrailRenderer> ();
 }
Пример #5
0
 // Start is called before the first frame update
 void Start()
 {
     trailRenderer = GetComponent <TrailRenderer>();
 }
Пример #6
0
 private void Start()
 {
     knobCenteredRotation = Knob.localRotation;
     Trail = GetComponent <TrailRenderer>();
 }
Пример #7
0
        public void Init(CatOrbiter parent, float soi)
        {
            TimingManager.FixedUpdateAdd(TimingManager.TimingStage.Earlyish, DoForces);

            orbiters.Add(this);
            rb             = gameObject.AddComponent <Rigidbody2D>();
            rb.isKinematic = true;

            if (orbiters.Count == 1)
            {
                sun = this;
                Vector3 spos = new Vector3(Screen.width * 0.5f, Screen.height * 0.5f, -1);
                transform.position = KSP.UI.UIMainCamera.Camera.ScreenToWorldPoint(spos);
                Mass  = 2E17;
                pos.x = transform.position.x;
                pos.y = transform.position.y;
            }
            else
            {
                Vector2 relativePos = Random.insideUnitCircle;
                if (relativePos.magnitude < 0.2)
                {
                    relativePos = relativePos.normalized * 0.3f;
                }
                Vector3 spos = UIMainCamera.Camera.WorldToScreenPoint(parent.transform.position) + (Vector3)(relativePos * soi);
                spos.z             = -1;
                transform.position = UIMainCamera.Camera.ScreenToWorldPoint(spos);

                pos.x = transform.position.x;
                pos.y = transform.position.y;

                //int scaleRange = 10;
                //
                //float factor = (1 + (scaleRange - 1) * Random.value);
                //
                //scale = parent.scale * factor / scaleRange;
                scale = parent.scale * 0.6f;

                transform.localScale *= scale;
                TrailRenderer trail = gameObject.GetComponent <TrailRenderer>();
                trail.colorGradient = new Gradient()
                {
                    alphaKeys = new GradientAlphaKey[3] {
                        new GradientAlphaKey(1, 0), new GradientAlphaKey(1, 0.7f), new GradientAlphaKey(0, 1)
                    }
                };
                trail.startWidth *= scale;
                //trail.endWidth *= scale;
                trail.widthCurve = new AnimationCurve(new Keyframe(0, trail.startWidth), new Keyframe(0.7f, trail.startWidth), new Keyframe(1, trail.startWidth * 0.9f));

                //Mass = factor * 2E16;

                Mass = parent.Mass * 0.025;

                Vector2d dist        = parent.pos - pos;
                double   circularVel = Math.Sqrt(G * (Mass + parent.Mass) / dist.magnitude);
                if (parent == sun)
                {
                    circularVel *= Random.Range(0.9f, 1.1f);
                }
                Debug.Log("CatOrbiter " + circularVel.ToString("F3") + " " + Mass.ToString("F2") + " " + orbiters[0].Mass.ToString("F2") + " " +
                          dist.magnitude.ToString("F2"));

                Vector3d normal = (Random.value >= 0.3) ? Vector3d.back : Vector3d.forward;

                Vector3d vel3d = Vector3d.Cross(dist, normal).normalized *circularVel;
                vel.x = parent.vel.x + vel3d.x;
                vel.y = parent.vel.y + vel3d.y;
            }

            rb.MovePosition(new Vector2((float)pos.x, (float)pos.y));
        }
Пример #8
0
 // Start is called before the first frame update
 void Start()
 {
     Ball  = GetComponentInParent <Ball>();
     Trail = GetComponent <TrailRenderer>();
 }
    public override void OnInspectorGUI()
    {
        RenderEffect   renderEffect   = target as RenderEffect;
        ParticleSystem particleSystem = renderEffect.gameObject.GetComponent <ParticleSystem>();

        EditorGUILayout.BeginVertical();


        if (particleSystem == null)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Open BillBoardOption");
            renderEffect.m_EnableBillBoard = EditorGUILayout.Toggle(renderEffect.m_EnableBillBoard);
            EditorGUILayout.EndHorizontal();

            if (renderEffect.m_EnableBillBoard)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("BillBoard Type");
                renderEffect.m_BillBoardType = (RenderBillBoardType)EditorGUILayout.EnumPopup(renderEffect.m_BillBoardType);
                EditorGUILayout.EndHorizontal();
                EditorGUI.indentLevel--;
            }
        }

        if (particleSystem == null)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Open Sort Layer Option");
            renderEffect.m_EnableSetSortLayer = EditorGUILayout.Toggle(renderEffect.m_EnableSetSortLayer);
            EditorGUILayout.EndHorizontal();
            if (renderEffect.m_EnableSetSortLayer)
            {
                EditorGUI.indentLevel++;
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Sorting Layer");
                renderEffect.m_SortingLayerID = EditorGUILayout.IntPopup(renderEffect.m_SortingLayerID, m_LayerName, m_LayerID);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Sorting Order");
                renderEffect.m_SortingOrder = EditorGUILayout.IntField(renderEffect.m_SortingOrder);
                EditorGUILayout.EndHorizontal();

                if (EditorGUI.EndChangeCheck())
                {
                    renderEffect.UpdateRenderLayer();
                }
                EditorGUI.indentLevel--;
            }
        }
        Renderer render = renderEffect.gameObject.GetComponent <Renderer>();

        if (render != null)
        {
            if (GUILayout.Button("Refresh Material"))
            {
                renderEffect.RefreshMaterial();
            }
            EditorGUILayout.LabelField("Materials");
        }
        EditorGUI.indentLevel++;
        int index = 0;

        foreach (MaterialEffect matEffect in renderEffect.m_MaterialEffects)
        {
            string strIndex = "Element:" + index + "    ";
            if (matEffect.m_EffectMaterial == null)
            {
                GUILayout.Button(strIndex + "Material Not Assign");
                index++;
                continue;
            }
            else
            {
                if (GUILayout.Button(strIndex + matEffect.m_EffectMaterial.name))
                {
                    matEffect.m_EditorExtend = !matEffect.m_EditorExtend;
                }
                index++;
                if (matEffect.m_EditorExtend)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Main Texture WrapMode");
                    matEffect.m_MainTexWrapMode = (TextureWrapMode)EditorGUILayout.EnumPopup(matEffect.m_MainTexWrapMode);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Cutoff Texture WrapMode");
                    matEffect.m_MaskTexWrapMode = (TextureWrapMode)EditorGUILayout.EnumPopup(matEffect.m_MaskTexWrapMode);
                    EditorGUILayout.EndHorizontal();
                }
            }
        }

        EditorGUI.indentLevel--;
        if (render != null && particleSystem == null)
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.LabelField("Switch Render Type");
            if (render.GetType() != typeof(LineRenderer))
            {
                if (GUILayout.Button("Switch To Line Render"))
                {
                    LineRenderer lineRender = renderEffect.gameObject.AddComponent <LineRenderer>();
                    renderEffect.m_Render      = lineRender;
                    lineRender.sharedMaterials = render.sharedMaterials;
                    UnityEngine.Object.DestroyImmediate(render);
                    MeshFilter meshFilter = renderEffect.gameObject.GetComponent <MeshFilter>();
                    if (meshFilter != null)
                    {
                        UnityEngine.Object.DestroyImmediate(meshFilter);
                    }
                    Collider meshCollider = renderEffect.gameObject.GetComponent <Collider>();
                    if (meshCollider != null)
                    {
                        UnityEngine.Object.DestroyImmediate(meshCollider);
                    }
                    EditorGUIUtility.ExitGUI();
                }
            }
            if (render.GetType() != typeof(MeshRenderer))
            {
                if (GUILayout.Button("Switch To Mesh Render"))
                {
                    MeshRenderer lineRender = renderEffect.gameObject.AddComponent <MeshRenderer>();
                    lineRender.sharedMaterials = render.sharedMaterials;
                    renderEffect.m_Render      = lineRender;
                    UnityEngine.Object.DestroyImmediate(render);
                    MeshFilter meshFilter = renderEffect.gameObject.GetComponent <MeshFilter>();
                    if (meshFilter == null)
                    {
                        renderEffect.gameObject.AddComponent <MeshFilter>();
                    }
                    Collider Collider = renderEffect.gameObject.GetComponent <Collider>();
                    if (Collider != null)
                    {
                        UnityEngine.Object.DestroyImmediate(Collider);
                    }
                    MeshCollider meshCollider = renderEffect.gameObject.GetComponent <MeshCollider>();
                    if (meshCollider == null)
                    {
                        renderEffect.gameObject.AddComponent <MeshCollider>();
                    }
                    EditorGUIUtility.ExitGUI();
                }
            }
            if (render.GetType() != typeof(TrailRenderer))
            {
                if (GUILayout.Button("Switch To Trail Render"))
                {
                    TrailRenderer lineRender = renderEffect.gameObject.AddComponent <TrailRenderer>();
                    lineRender.sharedMaterials = render.sharedMaterials;
                    renderEffect.m_Render      = lineRender;
                    UnityEngine.Object.DestroyImmediate(render);
                    MeshFilter meshFilter = renderEffect.gameObject.GetComponent <MeshFilter>();
                    if (meshFilter != null)
                    {
                        UnityEngine.Object.DestroyImmediate(meshFilter);
                    }
                    Collider Collider = renderEffect.gameObject.GetComponent <Collider>();
                    if (Collider != null)
                    {
                        UnityEngine.Object.DestroyImmediate(Collider);
                    }
                    EditorGUIUtility.ExitGUI();
                }
            }
            if (render.GetType() == typeof(TrailRenderer))
            {
                if (GUILayout.Button("Clear Trail"))
                {
                    TrailRenderer trailRender = render.GetComponent <TrailRenderer> ();
                    trailRender.Clear();
                }
            }
            EditorGUI.indentLevel--;
        }


        EditorGUILayout.EndVertical();
    }
Пример #10
0
 void Start()
 {
     skidMark = skidTrailRenderer.GetComponent <TrailRenderer>();
     //this avoids a visual bug on first use, if the art team set the effect’s time to 0.
     skidMark.time = skidLife;
 }
Пример #11
0
 void OnEnable()
 {
     tr            = GetComponent <TrailRenderer>();
     tr.startColor = playerRenderer.material.color;
     tr.endColor   = new Color(playerRenderer.material.color.r, playerRenderer.material.color.g, playerRenderer.material.color.b, 0);
 }
Пример #12
0
 void Awake()
 {
     m_trailRenderer = GetComponent <TrailRenderer>();
     m_wait          = new WaitForSeconds(m_cycleTime);
     m_currentIndex  = Random.Range(0, m_trailMaterials.Length);
 }
Пример #13
0
    public IEnumerator processImage()
    {
        TrailRenderer tr = GetComponent <TrailRenderer> ();
        LineRenderer  ln = GameObject.Find("drawer").GetComponent <LineRenderer> ();
        Camera        c1 = GameObject.Find("Camera (eye)").GetComponent <Camera> ();
        Camera        c2 = GameObject.Find("SeconderyCamera").GetComponent <Camera> ();

        Debug.Log(c2);
        RenderTexture rt = new RenderTexture(Screen.width, Screen.height, 24);

        c2.targetTexture = rt;
        ln.positionCount = tr.positionCount;
        Vector3[] arr = new Vector3[tr.positionCount];
        tr.GetPositions(arr);
        Vector3 center = ctrl.transform.position - tr.bounds.center;

        for (int i = 0; i < tr.positionCount; i++)
        {
            //move points to center of controller and then put them as local coordinates in front of camera
            arr[i] = ctrl.transform.InverseTransformPoint(arr[i] + center) + c2.gameObject.transform.position + c2.transform.forward;
        }
        Vector3 min = arr [0], max = arr [0];

        //Debug.Log ("before Loop " + min + "" + max);
        foreach (Vector3 v in arr)
        {
            //Debug.Log (v);
            if (v.x < min.x)
            {
                min.x = v.x;
            }
            if (v.y < min.y)
            {
                min.y = v.y;
            }
            if (v.z < min.z)
            {
                min.z = v.z;
            }

            if (v.y > max.y)
            {
                max.y = v.y;
            }
            if (v.x > max.x)
            {
                max.x = v.x;
            }
            if (v.z > max.z)
            {
                max.z = v.z;
            }
        }


        ln.SetPositions(arr);

        LineRenderer ln2 = GameObject.Find("Camera (eye)").GetComponent <LineRenderer> ();

        Vector3[] arr2 = { min, max };
        ln2.SetPositions(arr2);
        ln2.positionCount = 2;
        yield return(new WaitForEndOfFrame());

        Texture2D image = RTImage(c2, min, max);// new Texture2D(900, 500);

        File.WriteAllBytes(Application.dataPath + "\\..\\img.png", image.EncodeToPNG());
        NetworkStream stream = tcp.GetStream();
        StreamWriter  writer = new StreamWriter(stream);

        writer.WriteLine('s');
        writer.Flush();
        new Thread(() =>
        {
            Debug.Log("Thread Started");
            StreamReader reader = new StreamReader(stream);
            string num          = reader.ReadLine();
            Debug.Log(num);
            if (num == "5")
            {
                actionIndex = 0;
            }
            else if (num == "7")
            {
                actionIndex = 1;
            }
            else if (num == "8")
            {
                actionIndex = 2;
            }
            else
            {
                processAim = true;
            }
        }).Start();

        actionPos = tr.bounds.center; //ctrl.transform.position;// + 0.2f * dir;

        tr.Clear();
        //   ss();
        GetComponent <TrailRenderer> ().Clear();
        GetComponent <TrailRenderer> ().enabled = false;
    }
Пример #14
0
    private IEnumerator EnableTrailRendererOnFleetShipAfterDelay(TrailRenderer trailRenderer)
    {
        yield return(new WaitForSeconds(1));

        trailRenderer.enabled = true;
    }
Пример #15
0
 void Awake()
 {
     angle    = 0.0f;
     trailObj = GetComponent <TrailRenderer>();
 }
Пример #16
0
    // Update is called once per frame
    void Update()
    {
        if (tcScript.isLevelComplete || tcScript.isLevelFailed || tcScript.isMenuOpen)
        {
            return;
        }

        if (this.isWaitingToBeDestroyed)
        {
            TrailRenderer trailRenderer = this.gameObject.GetComponent <TrailRenderer> ();
            if (trailRenderer)
            {
                float currentTime      = (float)Time.time;
                float timeSinceDestroy = currentTime - timeAtDestroy;
                float t        = Mathf.Min(1.0f, timeSinceDestroy / 1.0f + 0.5f);
                Color newColor = Color.Lerp(Color.white, Color.clear, t);
                trailRenderer.material.SetColor("_TintColor", newColor);
            }
            return;
        }

        Utilities.DebugLog("Projectile.Update ()");
        if (this.currentState == ProjectileState.PROJECTILE_STATE_ACTIVE)
        {
            Utilities.DebugLog("AdjustedDistance () 1111111");
            this.distanceTravelled = TacticalCombat.AdjustedDistance(this.basePosition, this.initialPosition);
            this.percentTravelled  = this.distanceTravelled / this.range;

            if (this.isBallisticProjectile)
            {
                this.basePosition = new Vector2(this.basePosition.x + this.direction.x * this.speed * Time.deltaTime, this.basePosition.y + this.direction.y * this.speed * TacticalCombat.VERTICAL_SQUASH_RATIO * Time.deltaTime);

                if (this.isBouncingProjectile && percentTravelled != 0)
                {
                    this.ballisticShift = Mathf.Abs(Mathf.Sin(Mathf.PI * this.distanceTravelled * this.distanceTravelled * this.distanceTravelled / (this.range * this.range * this.range)) / (this.distanceTravelled * this.distanceTravelled) * (0.55f * this.range * this.range));
                }
                else
                {
                    this.ballisticShift = Mathf.Sin(Mathf.PI * percentTravelled) * ((18.0f /*900.0f*/ - this.range) / 10.0f /*500.0f*/);
                }
                this.fullBallisticShift = this.ballisticShift * this.ballisticHeight;
                //Utilities.DebugLog ("ballistic shift = " + fullBallisticShift + ", basePosition.y = " + this.basePosition.y);

                Vector2 oldPosition = this.gameObject.transform.position;
                Vector2 newPosition = new Vector2(this.basePosition.x, this.basePosition.y + this.fullBallisticShift);

                // Rotate Grenade Launcher projectile to face its current direction in arc
                if (this.isGrenadeLauncher)
                {
                    Vector3    vectorToTarget = new Vector3(newPosition.x - oldPosition.x, newPosition.y - oldPosition.y, 0);
                    float      angle          = Mathf.Atan2(vectorToTarget.y, vectorToTarget.x) * Mathf.Rad2Deg;
                    Quaternion q = Quaternion.AngleAxis(angle, Vector3.forward);
                    targetRotation = q;
                    this.gameObject.transform.rotation = Quaternion.Lerp(this.gameObject.transform.rotation, targetRotation, 0.5f);
                }

                this.gameObject.transform.position = newPosition;
            }
            else if (this.isBazooka)
            {
                float currentTime    = (float)Time.time;
                float timeSinceStart = currentTime - timeAtStart;
                float t = Mathf.Min(1.0f, timeSinceStart / 2.0f);
                t = 10.0f * t * t * t * t;
                float bazookaSpeed = Mathf.Lerp(0.2f * this.speed, 1.6f * this.speed, t);
                this.basePosition = new Vector2(this.basePosition.x + this.direction.x * bazookaSpeed * Time.deltaTime, this.basePosition.y + this.direction.y * bazookaSpeed * TacticalCombat.VERTICAL_SQUASH_RATIO * Time.deltaTime);
                this.gameObject.transform.position = this.basePosition;
            }
            else
            {
                this.basePosition = new Vector2(this.basePosition.x + this.direction.x * this.speed * Time.deltaTime, this.basePosition.y + this.direction.y * this.speed * TacticalCombat.VERTICAL_SQUASH_RATIO * Time.deltaTime);
                this.gameObject.transform.position = this.basePosition;
            }

            if (this.isBouncingProjectile)
            {
                if (this.distanceTravelled > 1.5f * this.range)
                {
                    DestroyProjectileAccordingToType();
                }
            }
            else
            {
                if (this.distanceTravelled > this.range)
                {
                    DestroyProjectileAccordingToType();
                }
            }
        }
    }
Пример #17
0
 private void Awake()
 {
     mainLineTrailRenderer = GetComponent <TrailRenderer>();
     mainLineEdgeCollider  = GetComponent <EdgeCollider2D>();
 }
Пример #18
0
 // Start is called before the first frame update
 void Start()
 {
     rigidBody     = GetComponent <Rigidbody>();
     audiosource   = GetComponent <AudioSource>();
     trailRenderer = GetComponentInChildren <TrailRenderer>();
 }
Пример #19
0
 private void Awake()
 {
     rb2d = GetComponent <Rigidbody2D>();
     sr   = GetComponent <SpriteRenderer>();
     tr   = GetComponent <TrailRenderer>();
 }
 void Awake()
 {
     TrailDrawer = GetComponent <TrailRenderer>();
 }
Пример #21
0
 private void Start()
 {
     _rigidbody       = GetComponent <Rigidbody>();
     _trailRenderer   = GetComponent <TrailRenderer>();
     originalRotation = transform.rotation;
 }
Пример #22
0
 void Start()
 {
     tr = skidmarkPrefab.GetComponent <TrailRenderer>();
 }
Пример #23
0
 public override void OnEnable() => Component = gameObject.GetComponent <TrailRenderer>();
Пример #24
0
    public void setTrailRenderer()
    {
        TrailRenderer tr = this.GetComponent <TrailRenderer>();

        tr.sortingLayerName = "Foreground";
    }
Пример #25
0
 public static ReadOnlyTrailRenderer AsReadOnly(this TrailRenderer self) => self.IsTrulyNull() ? null : new ReadOnlyTrailRenderer(self);
Пример #26
0
 // Use this for initialization
 void Start()
 {
     _renderer = GetComponent <TrailRenderer>();
     life      = GetComponent <LifePlayer>();
 }
        public static List <ComponentType> componentsOnGameObject(GameObject gameObject)
        {
            List <ComponentType> list      = new List <ComponentType>();
            Camera              component  = gameObject.GetComponent <Camera>();
            Light               component2 = gameObject.GetComponent <Light>();
            MeshFilter          component3 = gameObject.GetComponent <MeshFilter>();
            MeshRenderer        component4 = gameObject.GetComponent <MeshRenderer>();
            SkinnedMeshRenderer component5 = gameObject.GetComponent <SkinnedMeshRenderer>();
            Animation           component6 = gameObject.GetComponent <Animation>();
            Animator            component7 = gameObject.GetComponent <Animator>();
            ParticleSystem      component8 = gameObject.GetComponent <ParticleSystem>();

            BoxCollider     component10 = gameObject.GetComponent <BoxCollider>();
            SphereCollider  component11 = gameObject.GetComponent <SphereCollider>();
            CapsuleCollider component12 = gameObject.GetComponent <CapsuleCollider>();
            MeshCollider    component13 = gameObject.GetComponent <MeshCollider>();

            TrailRenderer component15 = gameObject.GetComponent <TrailRenderer>();
            LineRenderer  component16 = gameObject.GetComponent <LineRenderer>();

            list.Add(ComponentType.Transform);
            if ((UnityEngine.Object)component16 != (UnityEngine.Object)null)
            {
                list.Add(ComponentType.LineRenderer);
            }
            if ((UnityEngine.Object)component15 != (UnityEngine.Object)null)
            {
                list.Add(ComponentType.TrailRenderer);
            }

            if ((UnityEngine.Object)component6 != (UnityEngine.Object)null)
            {
                list.Add(ComponentType.Animation);
            }
            if ((UnityEngine.Object)component7 != (UnityEngine.Object)null)
            {
                list.Add(ComponentType.Animator);
            }
            if ((UnityEngine.Object)component != (UnityEngine.Object)null)
            {
                list.Add(ComponentType.Camera);
            }
            if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
            {
                if (component2.type == LightType.Directional)
                {
                    list.Add(ComponentType.DirectionalLight);
                }
                else if (component2.type == LightType.Point)
                {
                    list.Add(ComponentType.PointLight);
                }
                else if (component2.type == LightType.Spot)
                {
                    list.Add(ComponentType.SpotLight);
                }
            }
            if ((UnityEngine.Object)component3 != (UnityEngine.Object)null)
            {
                if ((UnityEngine.Object)component == (UnityEngine.Object)null)
                {
                    list.Add(ComponentType.MeshFilter);
                    if ((UnityEngine.Object)component4 == (UnityEngine.Object)null)
                    {
                        Debug.LogWarning("WXExport : " + gameObject.name + " need a MeshRenderer ComponentType !");
                    }
                }
                else if ((UnityEngine.Object)component != (UnityEngine.Object)null)
                {
                    Debug.LogWarning("WXExport : " + gameObject.name + " Camera and MeshFilter can't exist at the same time !");
                }
            }
            if ((UnityEngine.Object)component4 != (UnityEngine.Object)null)
            {
                if ((UnityEngine.Object)component == (UnityEngine.Object)null)
                {
                    list.Add(ComponentType.MeshRenderer);
                    if ((UnityEngine.Object)component3 == (UnityEngine.Object)null)
                    {
                        Debug.LogWarning("WXExport : " + gameObject.name + " need a meshFilter ComponentType !");
                    }
                }
                else if ((UnityEngine.Object)component != (UnityEngine.Object)null)
                {
                    Debug.LogWarning("WXExport : " + gameObject.name + " Camera and MeshRenderer can't exist at the same time !");
                }
            }
            if ((UnityEngine.Object)component5 != (UnityEngine.Object)null)
            {
                if ((UnityEngine.Object)component == (UnityEngine.Object)null && (UnityEngine.Object)component3 == (UnityEngine.Object)null && (UnityEngine.Object)component4 == (UnityEngine.Object)null)
                {
                    list.Add(ComponentType.SkinnedMeshRenderer);
                }
                else
                {
                    if ((UnityEngine.Object)component != (UnityEngine.Object)null)
                    {
                        Debug.LogWarning("WXExport : " + gameObject.name + " Camera and SkinnedMeshRenderer can't exist at the same time !");
                    }
                    if ((UnityEngine.Object)component3 != (UnityEngine.Object)null)
                    {
                        Debug.LogWarning("WXExport : " + gameObject.name + " MeshFilter and SkinnedMeshRenderer can't exist at the same time !");
                    }
                    if ((UnityEngine.Object)component4 != (UnityEngine.Object)null)
                    {
                        Debug.LogWarning("WXExport : " + gameObject.name + " MeshRenderer and SkinnedMeshRenderer can't exist at the same time !");
                    }
                }
            }
            if ((UnityEngine.Object)component8 != (UnityEngine.Object)null)
            {
                if ((UnityEngine.Object)component == (UnityEngine.Object)null && (UnityEngine.Object)component3 == (UnityEngine.Object)null && (UnityEngine.Object)component4 == (UnityEngine.Object)null && (UnityEngine.Object)component5 == (UnityEngine.Object)null)
                {
                    list.Add(ComponentType.ParticleSystem);
                }
                else
                {
                    if ((UnityEngine.Object)component != (UnityEngine.Object)null)
                    {
                        Debug.LogWarning("WXExport : " + gameObject.name + " Camera and ParticleSystem can't exist at the same time !");
                    }
                    if ((UnityEngine.Object)component3 != (UnityEngine.Object)null)
                    {
                        Debug.LogWarning("WXExport : " + gameObject.name + " MeshFilter and ParticleSystem can't exist at the same time !");
                    }
                    if ((UnityEngine.Object)component4 != (UnityEngine.Object)null)
                    {
                        Debug.LogWarning("WXExport : " + gameObject.name + " MeshRenderer and ParticleSystem can't exist at the same time !");
                    }
                    if ((UnityEngine.Object)component5 != (UnityEngine.Object)null)
                    {
                        Debug.LogWarning("WXExport : " + gameObject.name + " SkinnedMeshRenderer and ParticleSystem can't exist at the same time !");
                    }
                }
            }
            return(list);
        }
Пример #28
0
 void Awake()
 {
     trailR = GetComponent <TrailRenderer>();
 }
 public static Tween TweenStartWidth(this TrailRenderer renderer, float to, float duration) =>
 Tweening.To(getter: () => renderer.startWidth,
             setter: startWidth => renderer.startWidth = startWidth,
             to, duration).SetTarget(renderer);
Пример #30
0
 // Set initial movement for bullet and trail renderer
 void Start()
 {
     rb2D          = GetComponent <Rigidbody2D>();
     rb2D.velocity = -transform.up * bulletSpeed;
     Trail         = GetComponent <TrailRenderer>();
 }