Exemple #1
0
        /// <summary>
        ///  将影响范围内的点直接衍生至已影响范围的半径
        /// </summary>
        /// <param name="position">屏幕坐标</param>
        /// <param name="targetPosition">屏幕坐标</param>
        /// <param name="distance"></param>
        /// <param name="effectDistance"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="manager"></param>
        /// <param name="InfluenceEaseEnum"></param>
        /// <returns>屏幕 坐标</returns>
        public Vector2 CalculatePosition(Vector2 position, Vector2 targetPosition, float distance,
                                         float effectDistance, float width, float height, MagicWallManager manager)
        {
            Func <float, float> easeFun = EasingFunction.Get(manager.collisionBehaviorConfig.KinectRoundEaseEnum);

            //Vector2 panelOffset = positionWithOffset - position;

            if (distance > effectDistance)
            {
                return(position);
            }
            else
            {
                CollisionMoveBehaviourFactory collisionMoveBehaviourFactory = GameObject.Find("Collision").GetComponent <CollisionMoveBehaviourFactory>();

                // positionWithOffset 原位置
                // targetPosition 目标位置
                float k = collisionMoveBehaviourFactory.GetOffsetEffectDistance();
                //manager.collisionBehaviorConfig.KinectRoundOffsetInfluenceFactor;
                k = easeFun(k);

                float e = (effectDistance - distance) * k + distance;

                //Vector2 to = targetPosition + (positionWithOffset - targetPosition).normalized * effectDistance;
                Vector2 to = targetPosition + (position - targetPosition).normalized * e;

                //to = to - panelOffset;
                return(to);
            }
        }
Exemple #2
0
        public float GetEffectDistance()
        {
            CollisionMoveBehaviourFactory collisionMoveBehaviourFactory = GameObject.Find("Collision").GetComponent <CollisionMoveBehaviourFactory>();
            var influenceMoveFactor = collisionMoveBehaviourFactory.GetMoveEffectDistance();
            var effectDistance      = GetWidth() * influenceMoveFactor;

            return(effectDistance);
        }