示例#1
0
        private void Awake()
        {
            partSys         = base.gameObject.GetComponentInChildren <ParticleSystem>();
            rotateScript    = base.gameObject.GetComponentInChildren <RotateTransform>();
            animCurveScript = base.gameObject.GetComponent <MovementAnimationCurve>();
            rigidBody       = base.gameObject.GetComponent <Rigidbody>();
            triggerScript   = base.gameObject.GetComponentInChildren <TargetCollectibleTrigger>();
            triggerScript.Init();
            meshRend               = base.gameObject.GetComponent <MeshRenderer>();
            sphereColl             = base.gameObject.GetComponent <SphereCollider>();
            slipperyPhysicMaterial = new PhysicMaterial();
            slipperyPhysicMaterial.dynamicFriction = 0f;
            slipperyPhysicMaterial.staticFriction  = 0f;
            slipperyPhysicMaterial.bounciness      = 0f;
            slipperyPhysicMaterial.bounceCombine   = PhysicMaterialCombine.Minimum;
            slipperyPhysicMaterial.frictionCombine = PhysicMaterialCombine.Minimum;
            stickyPhysicMaterial = new PhysicMaterial();
            stickyPhysicMaterial.dynamicFriction = float.PositiveInfinity;
            stickyPhysicMaterial.staticFriction  = float.PositiveInfinity;
            stickyPhysicMaterial.bounciness      = 0f;
            stickyPhysicMaterial.bounceCombine   = PhysicMaterialCombine.Minimum;
            stickyPhysicMaterial.frictionCombine = PhysicMaterialCombine.Maximum;
            float num = base.gameObject.transform.position.x / 1.5f + base.gameObject.transform.position.y / 1.5f + base.gameObject.transform.position.z / 1.5f;

            animCurveScript.startPosition = Mathf.Abs(num - Mathf.Round(num));
            rigidBody.angularDrag         = float.PositiveInfinity;
            ChangeState(SceneryState.READY_TO_ACTIVATE);
        }
示例#2
0
 public override void Awake()
 {
     base.Awake();
     if (InteractionObj != null)
     {
         base.InteractionPath = InteractionObj.GetPath();
     }
     else
     {
         Log.LogError(this, $"{base.Path} requires an interation object to be defined on the prefab.");
     }
     partSys                = base.gameObject.GetComponentInChildren <ParticleSystem>();
     rotateScript           = base.gameObject.GetComponentInChildren <RotateTransform>();
     animCurveScript        = base.gameObject.GetComponent <MovementAnimationCurve>();
     rigidBody              = base.gameObject.GetComponent <Rigidbody>();
     triggerScript          = base.gameObject.GetComponentInChildren <SceneryCollectibleTrigger>();
     meshRend               = base.gameObject.GetComponent <MeshRenderer>();
     sphereColl             = base.gameObject.GetComponent <SphereCollider>();
     slipperyPhysicMaterial = new PhysicMaterial();
     slipperyPhysicMaterial.dynamicFriction = 0f;
     slipperyPhysicMaterial.staticFriction  = 0f;
     slipperyPhysicMaterial.bounciness      = 0f;
     slipperyPhysicMaterial.bounceCombine   = PhysicMaterialCombine.Minimum;
     slipperyPhysicMaterial.frictionCombine = PhysicMaterialCombine.Minimum;
     stickyPhysicMaterial = new PhysicMaterial();
     stickyPhysicMaterial.dynamicFriction = float.PositiveInfinity;
     stickyPhysicMaterial.staticFriction  = float.PositiveInfinity;
     stickyPhysicMaterial.bounciness      = 0f;
     stickyPhysicMaterial.bounceCombine   = PhysicMaterialCombine.Minimum;
     stickyPhysicMaterial.frictionCombine = PhysicMaterialCombine.Maximum;
     if (animCurveScript != null)
     {
         float num = base.gameObject.transform.position.x / 1.5f + base.gameObject.transform.position.y / 1.5f + base.gameObject.transform.position.z / 1.5f;
         animCurveScript.startPosition = Mathf.Abs(num - Mathf.Round(num));
     }
     if (rigidBody != null)
     {
         rigidBody.angularDrag = float.PositiveInfinity;
     }
     else
     {
         Log.LogError(this, $"Error: collectible '{base.gameObject.GetPath()}' is missing a rigidbody, will not function correctly");
     }
     originalPos = base.gameObject.transform.position;
     originalRot = base.gameObject.transform.rotation;
     if (Camera.main != null)
     {
         activeCamera = Camera.main;
     }
     originalParent     = base.gameObject.transform.parent;
     originalLossyScale = base.gameObject.transform.lossyScale;
     originalLocalScale = base.gameObject.transform.localScale;
     changeState(SceneryState.INVISIBLE);
 }
示例#3
0
 public override void Awake()
 {
     base.Awake();
     rendObject      = base.gameObject.GetComponentInChildren <Renderer>();
     partSys         = base.gameObject.GetComponentInChildren <ParticleSystem>();
     scriptAnimCurve = base.gameObject.GetComponentInChildren <MovementAnimationCurve>();
     scriptRotate    = base.gameObject.GetComponentInChildren <RotateTransform>();
     if (ViewTransform == null)
     {
         ViewTransform = base.gameObject.GetComponent <Transform>();
     }
     originalPos = ViewTransform.position;
     if (scriptAnimCurve != null)
     {
         float num = base.gameObject.transform.position.x / 1.5f + base.gameObject.transform.position.y / 1.5f + base.gameObject.transform.position.z / 1.5f;
         scriptAnimCurve.startPosition = Mathf.Abs(num - Mathf.Round(num));
     }
     withinInfluenceRange = false;
     setVisible(isVisible: false);
     setActive(isEnabled: false);
 }