コード例 #1
0
ファイル: Fish.cs プロジェクト: errcw/fishing-girl
        /// <summary>
        /// Creates a new fish.
        /// </summary>
        public Fish(FishDescription description, FishMovement movement, FishBehavior behavior, FishingState fishing)
        {
            _description = description;
            _movement    = movement;
            _behavior    = behavior;
            _fishing     = fishing;

            _position = new Vector2(700f, _movement.Range.Y);
            _velocity = _targetVelocity = new Vector2(_movement.Speed, 0f);
        }
コード例 #2
0
ファイル: Ocean.cs プロジェクト: errcw/fishing-girl
        /// <summary>
        /// Creates a semi-random fish. The fish's rarity, modifier, and speed are chosen randomly.
        /// </summary>
        /// <param name="size">The size of the fish.</param>
        /// <param name="left">The left side of fish's path.</param>
        /// <param name="right">The right edge of the fish's path.</param>
        /// <param name="depth">The depth at which the fish swims.</param>
        private Fish CreateFish(FishSize size, float left, float right, float depth)
        {
            FishDescription description = new FishDescription(
                size,
                GetRandomRarity(),
                GetRandomModifier());

            FishMovement movement = new FishMovement(
                GetRandomSpeed(description),
                300f,
                new Vector4(left, depth - 5f, right, depth + 5f));

            FishBehavior behavior = new FishBehavior(
                150f,
                (float)(Math.PI / 6),
                2f);

            Fish fish = new Fish(description, movement, behavior, _fishing);

            fish.LoadContent(_content);

            return(fish);
        }