Ejemplo n.º 1
0
    /*protected override void OnPingFinish()
     * {
     *      SetAmountToMove(true, 1f);
     * }
     *
     * protected override void OnPongFinish()
     * {
     *      SetAmountToMove(false, 1f);
     * }*/

    #endregion

    #region Other Methods

    private void CheckIfCanClampInitialValues(bool p_isPing)
    {
        if (Owner != null)
        {
            if (UseVectorsToClampInitialValues && MoveTypeOption != MoveTypeOptionEnum.MoveBy)
            {
                if (p_isPing)
                {
                    Vector3 v_vector = GetTransformVector();
                    v_vector.x = EnumHelper.ContainsLongFlag((long)MoveTypeOption, (long)MoveTypeOptionEnum.MoveToX)? MoveBackVector.x : v_vector.x;
                    v_vector.y = EnumHelper.ContainsLongFlag((long)MoveTypeOption, (long)MoveTypeOptionEnum.MoveToY)? MoveBackVector.y : v_vector.y;
                    v_vector.z = EnumHelper.ContainsLongFlag((long)MoveTypeOption, (long)MoveTypeOptionEnum.MoveToZ)? MoveBackVector.z : v_vector.z;
                    SetTransformVector(v_vector);
                }
                else if (UseMoveBackVector)
                {
                    SetTransformVector(MoveVector);
                }
            }
        }
    }
Ejemplo n.º 2
0
    /*protected override void OnPingFinish()
     * {
     *      SetAmountToRotate(true, 1f);
     * }
     *
     * protected override void OnPongFinish()
     * {
     *      SetAmountToRotate(false, 1f);
     * }*/

    #endregion

    #region Other Methods

    private void CheckIfCanClampInitialValues(bool p_isPing)
    {
        if (Owner != null)
        {
            if (UseVectorsToClampInitialValues && RotationTypeOption != RotationTypeOptionEnum.RotateBy)
            {
                if (p_isPing)
                {
                    if (IsLocalRotation)
                    {
                        Vector3 v_vectorLocal = new Vector3(Owner.transform.localEulerAngles.x, Owner.transform.localEulerAngles.y, Owner.transform.localEulerAngles.z);
                        v_vectorLocal.x = EnumHelper.ContainsLongFlag((long)RotationTypeOption, (long)RotationTypeOptionEnum.RotateToX)? RotateBackVector.x : v_vectorLocal.x;
                        v_vectorLocal.y = EnumHelper.ContainsLongFlag((long)RotationTypeOption, (long)RotationTypeOptionEnum.RotateToY)? RotateBackVector.y : v_vectorLocal.y;
                        v_vectorLocal.z = EnumHelper.ContainsLongFlag((long)RotationTypeOption, (long)RotationTypeOptionEnum.RotateToZ)? RotateBackVector.z : v_vectorLocal.z;
                        Owner.transform.localEulerAngles = v_vectorLocal;
                    }
                    else
                    {
                        Vector3 v_vectorGlobal = new Vector3(Owner.transform.eulerAngles.x, Owner.transform.eulerAngles.y, Owner.transform.eulerAngles.z);
                        v_vectorGlobal.x            = EnumHelper.ContainsLongFlag((long)RotationTypeOption, (long)RotationTypeOptionEnum.RotateToX)? RotateBackVector.x : v_vectorGlobal.x;
                        v_vectorGlobal.y            = EnumHelper.ContainsLongFlag((long)RotationTypeOption, (long)RotationTypeOptionEnum.RotateToY)? RotateBackVector.y : v_vectorGlobal.y;
                        v_vectorGlobal.z            = EnumHelper.ContainsLongFlag((long)RotationTypeOption, (long)RotationTypeOptionEnum.RotateToZ)? RotateBackVector.z : v_vectorGlobal.z;
                        Owner.transform.eulerAngles = v_vectorGlobal;
                    }
                }
                else if (UseRotateBackVector)
                {
                    if (IsLocalRotation)
                    {
                        Owner.transform.localEulerAngles = RotateVector;
                    }
                    else
                    {
                        Owner.transform.eulerAngles = RotateVector;
                    }
                }
            }
        }
    }
Ejemplo n.º 3
0
    /*protected override void OnPingFinish()
     * {
     *      SetAmountToScale(true, 1f);
     * }
     *
     * protected override void OnPongFinish()
     * {
     *      SetAmountToScale(false, 1f);
     * }*/

    #endregion

    #region Other Methods

    private void CheckIfCanClampInitialValues(bool p_isPing)
    {
        if (Owner != null)
        {
            if (UseVectorsToClampInitialValues && ScaleTypeOption != ScaleTypeOptionEnum.ScaleBy && ScaleTypeOption != ScaleTypeOptionEnum.ScalePercentBy)
            {
                if (p_isPing)
                {
                    if (IsLocalScale)
                    {
                        Vector3 v_vectorLocal = new Vector3(Owner.transform.localScale.x, Owner.transform.localScale.y, Owner.transform.localScale.z);
                        v_vectorLocal.x            = EnumHelper.ContainsLongFlag((long)ScaleTypeOption, (long)ScaleTypeOptionEnum.ScaleToX)? ScaleBackVector.x : v_vectorLocal.x;
                        v_vectorLocal.y            = EnumHelper.ContainsLongFlag((long)ScaleTypeOption, (long)ScaleTypeOptionEnum.ScaleToY)? ScaleBackVector.y : v_vectorLocal.y;
                        v_vectorLocal.z            = EnumHelper.ContainsLongFlag((long)ScaleTypeOption, (long)ScaleTypeOptionEnum.ScaleToZ)? ScaleBackVector.z : v_vectorLocal.z;
                        Owner.transform.localScale = v_vectorLocal;
                    }
                    else
                    {
                        Vector3 v_vectorGlobal = new Vector3(Owner.transform.lossyScale.x, Owner.transform.lossyScale.y, Owner.transform.lossyScale.z);
                        v_vectorGlobal.x = EnumHelper.ContainsLongFlag((long)ScaleTypeOption, (long)ScaleTypeOptionEnum.ScaleToX)? ScaleBackVector.x : v_vectorGlobal.x;
                        v_vectorGlobal.y = EnumHelper.ContainsLongFlag((long)ScaleTypeOption, (long)ScaleTypeOptionEnum.ScaleToY)? ScaleBackVector.y : v_vectorGlobal.y;
                        v_vectorGlobal.z = EnumHelper.ContainsLongFlag((long)ScaleTypeOption, (long)ScaleTypeOptionEnum.ScaleToZ)? ScaleBackVector.z : v_vectorGlobal.z;
                        KiltUtils.SetLossyScale(Owner.transform, v_vectorGlobal);
                    }
                }
                else if (UseScaleBackVector)
                {
                    if (IsLocalScale)
                    {
                        Owner.transform.localScale = ScaleVector;
                    }
                    else
                    {
                        KiltUtils.SetLossyScale(Owner.transform, ScaleVector);
                    }
                }
            }
        }
    }