コード例 #1
0
    // Token: 0x060004AF RID: 1199 RVA: 0x00016484 File Offset: 0x00014884
    private void DoAngleLimitation()
    {
        Quaternion localRotation = this._directTransform.localRotation;

        localRotation.x /= localRotation.w;
        localRotation.y /= localRotation.w;
        localRotation.z /= localRotation.w;
        localRotation.w  = 1f;
        ETCAxis.AxisInfluenced axisInfluenced = this.axisInfluenced;
        if (axisInfluenced != ETCAxis.AxisInfluenced.X)
        {
            if (axisInfluenced != ETCAxis.AxisInfluenced.Y)
            {
                if (axisInfluenced == ETCAxis.AxisInfluenced.Z)
                {
                    float num = 114.59156f * Mathf.Atan(localRotation.z);
                    num             = Mathf.Clamp(num, -this.minAngle, this.maxAngle);
                    localRotation.z = Mathf.Tan(0.008726646f * num);
                }
            }
            else
            {
                float num = 114.59156f * Mathf.Atan(localRotation.y);
                num             = Mathf.Clamp(num, -this.minAngle, this.maxAngle);
                localRotation.y = Mathf.Tan(0.008726646f * num);
            }
        }
        else
        {
            float num = 114.59156f * Mathf.Atan(localRotation.x);
            num             = Mathf.Clamp(num, -this.minAngle, this.maxAngle);
            localRotation.x = Mathf.Tan(0.008726646f * num);
        }
        this._directTransform.localRotation = localRotation;
    }
コード例 #2
0
    // Token: 0x060004AD RID: 1197 RVA: 0x000161DC File Offset: 0x000145DC
    private float GetAngle()
    {
        float num = 0f;

        if (this._directTransform != null)
        {
            ETCAxis.AxisInfluenced axisInfluenced = this.axisInfluenced;
            if (axisInfluenced != ETCAxis.AxisInfluenced.X)
            {
                if (axisInfluenced != ETCAxis.AxisInfluenced.Y)
                {
                    if (axisInfluenced == ETCAxis.AxisInfluenced.Z)
                    {
                        num = this._directTransform.localRotation.eulerAngles.z;
                    }
                }
                else
                {
                    num = this._directTransform.localRotation.eulerAngles.y;
                }
            }
            else
            {
                num = this._directTransform.localRotation.eulerAngles.x;
            }
            if (num <= 360f && num >= 180f)
            {
                num -= 360f;
            }
        }
        return(num);
    }
コード例 #3
0
    // Token: 0x060004AC RID: 1196 RVA: 0x00016184 File Offset: 0x00014584
    private Vector3 GetInfluencedAxis()
    {
        Vector3 result = Vector3.zero;

        ETCAxis.AxisInfluenced axisInfluenced = this.axisInfluenced;
        if (axisInfluenced != ETCAxis.AxisInfluenced.X)
        {
            if (axisInfluenced != ETCAxis.AxisInfluenced.Y)
            {
                if (axisInfluenced == ETCAxis.AxisInfluenced.Z)
                {
                    result = Vector3.forward;
                }
            }
            else
            {
                result = Vector3.up;
            }
        }
        else
        {
            result = Vector3.right;
        }
        return(result);
    }
コード例 #4
0
ファイル: ETCInput.cs プロジェクト: hafewa/CatsInStarvingLand
	public static void SetAxisAffectedAxis(string axisName, ETCAxis.AxisInfluenced value){
		if (ETCInput.instance.axes.TryGetValue( axisName, out axis)){
			axis.axisInfluenced = value;
		}
		else{
			Debug.LogWarning("ETCInput : " + axisName + " doesn't exist");
		}
	}
コード例 #5
0
    // Token: 0x060004AE RID: 1198 RVA: 0x000162A8 File Offset: 0x000146A8
    private void DoAutoStabilisation()
    {
        float num = this.GetAngle();

        if (num <= 360f && num >= 180f)
        {
            num -= 360f;
        }
        if (num > this.startAngle - this.autoStabThreshold || num < this.startAngle + this.autoStabThreshold)
        {
            float   num2 = 0f;
            Vector3 zero = Vector3.zero;
            if (num > this.startAngle - this.autoStabThreshold)
            {
                num2 = num + this.autoStabSpeed / 100f * Mathf.Abs(num - this.startAngle) * Time.deltaTime * -1f;
            }
            if (num < this.startAngle + this.autoStabThreshold)
            {
                num2 = num + this.autoStabSpeed / 100f * Mathf.Abs(num - this.startAngle) * Time.deltaTime;
            }
            ETCAxis.AxisInfluenced axisInfluenced = this.axisInfluenced;
            if (axisInfluenced != ETCAxis.AxisInfluenced.X)
            {
                if (axisInfluenced != ETCAxis.AxisInfluenced.Y)
                {
                    if (axisInfluenced == ETCAxis.AxisInfluenced.Z)
                    {
                        zero = new Vector3(this._directTransform.localRotation.eulerAngles.x, this._directTransform.localRotation.eulerAngles.y, num2);
                    }
                }
                else
                {
                    zero = new Vector3(this._directTransform.localRotation.eulerAngles.x, num2, this._directTransform.localRotation.eulerAngles.z);
                }
            }
            else
            {
                zero = new Vector3(num2, this._directTransform.localRotation.eulerAngles.y, this._directTransform.localRotation.eulerAngles.z);
            }
            this._directTransform.localRotation = Quaternion.Euler(zero);
        }
    }