Пример #1
0
 public EquipmentSet(Foot foot, Head head, Hand hand, Weapon weapon, Pants pants, Torso torso)
 {
     this._foot = foot;
     this._head = head;
     this._hand = hand;
     this._weapon = weapon;
     this._pants = pants;
     this._torso = torso;
 }
Пример #2
0
    static void Main()
    {
        Foot f = new Foot();
        vtest.baz( f, 3, 4 );
        jbaz( f, 1, 2 );

        Foo g = vtest.makeAFoo( );
        vtest.baz( g, 5, 6 );
        jbaz( g, 7, 8 );
    }
Пример #3
0
        public Player Generate(Gender?playerGender = null, Country[] countries = null, PlayerPosition playerPosition = null)
        {
            if (playerGender == null)
            {
                playerGender = _genderGenerator.Generate();
            }

            if (countries == null)
            {
                countries = _countriesGenerator.Generate().Value;
            }

            PersonName playerName = _nameGenerator.Generate(playerGender.Value, countries.FirstOrDefault());
            Date       dob        = _dobGenerator.Generate();

            PersonAge playerAge = PersonAge.FromDate(dob, _game.CurrentDate);

            Location           birthLocation    = _birthLocationGenerator.Generate(countries.FirstOrDefault());
            Foot               playerFoot       = _favouriteFootGenerator.Generate();
            Percentile         percentile       = _percentileGenerator.Generate();
            BodyMassIndex      bmi              = _bmiGenerator.Generate(countries.FirstOrDefault(), playerGender.Value, percentile, dob);
            PlayerPosition     position         = _playerPositionGenerator.Generate();
            PhysicalFeatureSet playerFeatureSet = _physicalFeatureSetGenerator.Generate(position, bmi, countries.FirstOrDefault(), playerAge);

            // first name & last name => according to the player's country
            return(new PlayerBuilder()
                   .WithName(playerName)
                   .WithGender(playerGender.Value)
                   .WithBirthInfo(new BirthInfo(dob, birthLocation))
                   .WithFoot(playerFoot)
                   .WithPercentile(percentile)
                   .WithBodyMassIndex(bmi)
                   .WithPlayerPosition(position)
                   .WithFeatureSet(playerFeatureSet)
                   .WithCountries(countries)
                   .Build());
        }
Пример #4
0
    public void FootPrintActive(Vector3 worldPos, float yDegress, Foot foot)
    {
        Shader.SetGlobalFloat("_FootPrintBumpScale", _footPrintBumpScale);
        Shader.SetGlobalFloat("_FootPrintSize", _footPrintSize * _rootScale);
        Shader.SetGlobalVector("_DeltaFootPosition", worldPos - worldPos);
        Shader.SetGlobalFloat("_YDegress", yDegress);

        // Debug.Log(yDegress);

        var       alpha  = yDegress * Mathf.PI / 180.0f;
        var       sina   = Mathf.Sin(alpha);
        var       cosa   = Mathf.Cos(alpha);
        Matrix4x4 matrix = new Matrix4x4()
        {
            m00 = cosa,
            m01 = -sina,
            m10 = sina,
            m11 = cosa,
        };

        Shader.SetGlobalMatrix("_RotationFootPrint", matrix);

        var noFlipPrint = 1;

        if ((foot == Foot.Left && !_isLeftFootPrintBump) || (foot == Foot.Right && _isLeftFootPrintBump))
        {
            noFlipPrint = 0;
        }
        Shader.SetGlobalInt("_IsLeftFoot", noFlipPrint);
        // Shader.SetGlobalTexture("_FootPrintBump", foot == Foot.Left ? _leftFootPrintBump : _rightFootPrintBump);

        // Graphics.Blit(_srcRenderTexture, _dstRenderTexture, _footPrintMaterial, (int)FootPrintPass.Generator);
        // Graphics.Blit(_dstRenderTexture, _srcRenderTexture);

        SwitchRenderTexture(out var srcRT, out var dstRT);
        Graphics.Blit(srcRT, dstRT, _footPrintMaterial, (int)FootPrintPass.Generator);
    }
Пример #5
0
    private bool DefineNextStep(Foot foot, Vector2 targetDestination)
    {
        BoneJoint footJoint = foot.joint;

        foot.stepTargetDefined = true;
        Vector3 stepTarget        = footJoint.closestBodyJoint.transform.position;
        float   xDistTargetToFoot = targetDestination.x - footJoint.transform.position.x;
        float   stepWidth         = Random.Range(m_minFootStepWidth, m_maxFootStepWidth);

        stepTarget.x          += ((xDistTargetToFoot > 0) ? 1 : -1) * (stepWidth * footJoint.maxDistanceFromBodyJoint);
        stepTarget.y           = m_floorY;                                              //DEBUG until I implement raycasts
        foot.currentStepHeight = m_footStepHeight * footJoint.maxDistanceFromBodyJoint; // Random.Range(minRand, maxRand);
        foot.currentTarget     = GetPosLocked(footJoint.closestBodyJoint.transform.position, stepTarget, footJoint.maxDistanceFromBodyJoint * 0.8f);
        foot.currentTarget.y   = m_floorY;
        m_target = foot.currentTarget;

        m_vector2Gizmos       = foot.currentTarget;
        foot.stepCompleteness = 0;
        foot.startStepPos     = footJoint.transform.position;

        if (foot.startStepPos == foot.currentTarget) // if we are already here
        {
            Debug.LogError("oddly we are already here");
            foot.isGrounded        = true;
            foot.stepTargetDefined = false;
            return(false);
        }
        if (Vector3.Distance(foot.currentTarget, targetDestination) > Vector3.Distance(footJoint.transform.position, targetDestination))
        {
            //Debug.Log("the next step would be worse or equal");
            foot.isGrounded        = true;
            foot.stepTargetDefined = false;
            return(false);
        }
        return(true);
    }
Пример #6
0
 public static Player CreatePlayer
 (
     PersonName name,
     Gender gender,
     BirthInfo birthInfo,
     Foot favouriteFoot,
     BodyMassIndex bmi,
     Percentile percentile,
     PhysicalFeatureSet physicalFeatureSet,
     PlayerPosition playerPosition,
     params Country[] nationalities
 ) => new Player
 (
     PersonId.CreateNew(),
     name,
     gender,
     birthInfo,
     favouriteFoot,
     bmi,
     percentile,
     physicalFeatureSet,
     playerPosition,
     nationalities
 );
Пример #7
0
        private void UpdateFoot(Foot foot)
        {
            RaycastHit hit;

            float   rayMagnitude = this.controller.height / 2.0f;
            Vector3 rayPosition  = foot.foot.position;

            rayPosition.y += rayMagnitude / 2.0f;

            int layerMask = Physics.DefaultRaycastLayers;
            QueryTriggerInteraction queryTrigger = QueryTriggerInteraction.Ignore;

            if (Physics.Raycast(rayPosition, -Vector3.up, out hit, rayMagnitude, layerMask, queryTrigger))
            {
                foot.hit    = true;
                foot.height = hit.point.y;
                foot.normal = hit.normal;
            }
            else
            {
                foot.hit    = false;
                foot.height = foot.foot.position.y;
            }
        }
Пример #8
0
    private void Update()
    {
        if (grounded == false && animator.GetBool(groundedBool) == true)
        {
            PlayFootStep();
        }
        grounded = animator.GetBool(groundedBool);
        float factor = 0.15f;

        if (grounded == true && animator.velocity.magnitude > 1.6f)
        {
            oldDist = maxDist;
            switch (step)
            {
            case Foot.LEFT:
                dist    = leftFoot.position.y - transform.position.y;
                maxDist = dist > maxDist ? dist : maxDist;
                if (dist < factor)
                {
                    PlayFootStep();
                    step = Foot.RIGHT;
                }
                break;

            case Foot.RIGHT:
                dist    = rightFoot.position.y - transform.position.y;
                maxDist = dist > maxDist ? dist : maxDist;
                if (dist < factor)
                {
                    PlayFootStep();
                    step = Foot.LEFT;
                }
                break;
            }
        }
    }
Пример #9
0
        public GiantRat()
            : base()
        {
            CharRepresentation = 'r';
            DrawColor          = libtcodWrapper.ColorPresets.Brown;
            Type = CreatureTypes.Giant_Rat;

            Head  MyHead        = new Head(this, "Head", 60);
            Torso MyTorso       = new Torso(this, "Torso", 70);
            Foot  FrontLeftPaw  = new Foot(this, "Front Left Paw", 50);
            Foot  FrontRightPaw = new Foot(this, "Front Right Paw", 50);
            Foot  RearLeftPaw   = new Foot(this, "Rear Left Paw", 35);
            Foot  RearRightPaw  = new Foot(this, "Rear Right Paw", 35);
            Tail  MyTail        = new Tail(this, "Tail", 20);

            LimbDependencies.Add(new LimbDependency(MyHead, MyTorso));
            LimbDependencies.Add(new LimbDependency(MyTorso, MyHead));
            LimbDependencies.Add(new LimbDependency(FrontLeftPaw, MyTorso));
            LimbDependencies.Add(new LimbDependency(FrontRightPaw, MyTorso));
            LimbDependencies.Add(new LimbDependency(RearLeftPaw, MyTorso));
            LimbDependencies.Add(new LimbDependency(RearRightPaw, MyTorso));
            LimbDependencies.Add(new LimbDependency(MyTail, MyTorso));

            PreferredLimbAttackOrder.Add(MyHead);
            PreferredLimbAttackOrder.Add(FrontRightPaw);
            PreferredLimbAttackOrder.Add(FrontLeftPaw);
            PreferredLimbAttackOrder.Add(MyTail);

            Limbs.Add(MyTorso);
            Limbs.Add(MyHead);
            Limbs.Add(FrontLeftPaw);
            Limbs.Add(FrontRightPaw);
            Limbs.Add(RearLeftPaw);
            Limbs.Add(RearRightPaw);
            Limbs.Add(MyTail);
        }
Пример #10
0
        private void FixedUpdate()
        {
            if (surfaceEffect == null)
            {
                return;
            }

            if (r.velocity.sqrMagnitude > minVelocity * minVelocity)
            {
                //  Determine which foot is raised.
                if (animator.pivotWeight > 0.5f)
                {
                    raisedFoot = rightFoot;
                }
                else if (animator.pivotWeight < 0.5f)
                {
                    raisedFoot = leftFoot;
                }
                else
                {
                    raisedFoot = null;
                }

                if (raisedFoot != null)
                {
                    //  Get the height of the raised foot.
                    raisedFootHeight = raisedFoot.foot.position.y - transform.position.y;
                    //  Is raised foot low enough to check if it is considered down;
                    if (raisedFootHeight <= footOffset && Time.time > raisedFoot.stepTime + 0.1f)
                    {
                        //  If rasied foot is low enough to be considered down, has it moved enough frames.
                        if (frameCount >= moveDirectionFrameCount)
                        {
                            RaycastHit hit;
                            if (Physics.Raycast(raisedFoot.foot.position, -transform.up, out hit, 0.1f + footOffset, layerManager.SolidLayers))
                            {
                                var position     = hit.point + transform.up * footOffset;
                                var fwdDirection = Vector3.Cross(transform.right, hit.normal);
                                var rotation     = Quaternion.LookRotation(fwdDirection, hit.normal);

                                surfaceEffect.SpawnSurfaceEffect(position, rotation, raisedFoot.audioSource);

                                //Debug.LogFormat("Foot: <b>{0}</b> | Height:  <b>{1}</b> | Velocity: {3} | FrameCount: {4} | Time:  <b>{2}</b>",
                                //    raisedFoot.foot.name, raisedFootHeight, Time.time, (float)Math.Round(r.velocity.sqrMagnitude, 2), frameCount);
                                //  Footeffect has spawned.
                                raisedFoot.stepTime = Time.time;
                                frameCount          = 0;
                                raisedFoot          = null;
                                return;
                            }
                        }
                        //  Foot is low enough, but hasn';t moved enough frames.
                        frameCount++;
                    }
                    //  Foot is not low enough to the ground.
                    return;
                }
            }
            //  Reset counts.
            raisedFootHeight = 0;
            frameCount       = 0;
        }
Пример #11
0
 public static RatioQuantity Feet(this int amount) => Foot.S(amount);
Пример #12
0
 private void OnFootstep(Foot foot)
 {
     (this.entity.model.prone.IsActive() ? this.proneFootstepAudio : this.footstepAudio).Play(this.footstepSource);
 }
Пример #13
0
        /// <summary>
        /// Gets the last index in the panel history where the foot does not match the specified current foot
        /// </summary>
        public static int GetLastIndexOfLastFoot(IList <PanelHistoryItem> history, Foot currentFoot)
        {
            var indexOfLastNote = GetLastIndexOfLastNote(history);

            return(GetIndexOfLastFoot(history, indexOfLastNote, currentFoot));
        }
Пример #14
0
        private static void Main(string[] args)
        {
            {
                var bits      = new Bit(8);
                var bytes     = (SystemOfUnits.DigitalInformation.Byte.Byte)bits * 3000;
                var kilobyte  = (Kilobyte)bytes;
                var kibibyte  = (Kibibyte)bytes;
                var yottabyte = (Yottabyte)bytes;
            }

            {
                var width  = (Pixel)2048;
                var height = (Pixel)1536;

                var totalPixels   = (Pixel)(width.Value * height.Value);
                var bytesPerPixel = (SystemOfUnits.DigitalInformation.Byte.Byte) 3;

                var fileSize  = (Mebibyte)bytesPerPixel * totalPixels.Value;
                var imageSize = ((Megapixel)totalPixels).Round(1);
            }

            {
                var metre12 = (Metre)12;
                var metre15 = (Metre)15;

                foreach (var item in new[] { metre12, metre15 }.OrderByDescending(x => x))
                {
                    Console.WriteLine(item);
                }
                Console.WriteLine();

                foreach (var item in new[] { metre12, metre15 }.OrderBy(x => x))
                {
                    Console.WriteLine(item);
                }
                Console.WriteLine();
            }

            {
                var    degree = Degree.Degrees45;
                Radian radian = degree;
            }

            {
                var  mile = (Mile)2d;
                Inch inch = mile;
                Foot foot = mile;
            }

            {
                var  inch = (Inch)2d;
                Mile mile = inch;
                Foot foot = inch;
            }
            {
                var kelvin     = new Kelvin(15);
                var fahrenheit = new Fahrenheit(7);
                var celsius    = new Celsius(35);

                foreach (var temperature in new ITemperatureUnit[] { kelvin, fahrenheit, celsius })
                {
                    Console.WriteLine($"{temperature}, to Kelvin: {temperature.ToKelvin()}");
                }

                Console.WriteLine();
            }

            {
                var a      = (Metre)2;
                var b      = (Metre)5;
                var c      = (Metre)7;
                var area   = a * b;
                var volume = area * c;
            }

            {
                var hours   = (Hour)2.5;
                var minutes = (Minute)hours;
                var seconds = (Second)hours;
            }

            {
                var day        = new Day(258);
                var percentage = new Percentage(10);
            }

            {
                var foo = new Foo {
                    Age = (Month)365, Distance = (Metre)10
                };
                var serialized   = JsonConvert.SerializeObject(foo);
                var deserialized = JsonConvert.DeserializeObject <Foo>(serialized);
            }

            {
                var foo = new Foo {
                    Age = (Month)365, Distance = (Metre)10
                };

                var xmlSerializer = new XmlSerializer(foo.GetType());
                using (var textWriter = new StringWriter()) {
                    xmlSerializer.Serialize(textWriter, foo);
                    var serialized = textWriter.ToString();
                }
            }
        }
Пример #15
0
 /// <summary>
 /// Disables a column for a foot
 /// This can be used to prevent the left foot from crossing over to the rightmost panels and vice versa
 /// </summary>
 public DisableColumnForFootRule(Foot foot, int column)
 {
     this.foot   = foot;
     this.column = MathUtil.Clamp(column, 0, PanelConfigUtil.maxColumns - 1);;
 }
Пример #16
0
        /// <summary>
        /// Handler for <see cref="FirstPersonPlayerModel"/>
        /// </summary>
        private void OnFootstep(Foot foot)
        {
            float dir = foot == Foot.Left ? -1 : 1;

            this.eulerSpring.AddForce(new Vector3(-this.footstepBobbing.x, this.footstepBobbing.y * dir, 0));
        }
        }                                            // 0x0000000180538700-0x0000000180538A80

        private void SetFootIK(Foot foot, float maxOffset)
        {
        }                                                             // 0x0000000180538520-0x0000000180538700
Пример #18
0
    void playFootStep()
    {
        Vector3 side = direction.rotatey((passingFoot == Foot.LEFT) ? 90 : -90);

        GameObject go = Pool.get(currentFootsteps.gameObject, transform.position + distanceToGround + direction * feetReachForward + side * feetGapWidth * 0.5f);
        go.GetComponent<FootStepScript>().Initialize();
        SoundSystemManager.HandleAudioSource(go);

        passingFoot = (passingFoot == Foot.LEFT) ? Foot.RIGHT : Foot.LEFT;
    }
Пример #19
0
        private Player MockPlayer(string name, string shortName, DateTime?birthDate, Nationality?nat, int?h, Foot foot, Position pos, int?number, int cap, DateTime?clubArrivalDate, DateTime?contractExpirationDate, decimal?mv, string imgUrl, string profileUrl)
        {
            Player domain = new Player();

            ((Core.ParseHandling.Elements.Player.BirthDate)domain.Elements.FirstOrDefault(e => e.InternalName == "BirthDate")).Value = new DatetimeValue {
                Value = birthDate
            };
            ((Core.ParseHandling.Elements.Player.Captain)domain.Elements.FirstOrDefault(e => e.InternalName == "Cap")).Value = new IntValue {
                Value = cap
            };
            ((Core.ParseHandling.Elements.Player.ClubArrivalDate)domain.Elements.FirstOrDefault(e => e.InternalName == "ClubArrivalDate")).Value = new DatetimeValue {
                Value = clubArrivalDate
            };
            ((Core.ParseHandling.Elements.Player.ContractExpirationDate)domain.Elements.FirstOrDefault(e => e.InternalName == "ContractExpirationDate")).Value = new DatetimeValue {
                Value = contractExpirationDate
            };
            ((Core.ParseHandling.Elements.Player.Height)domain.Elements.FirstOrDefault(e => e.InternalName == "H")).Value = new IntValue {
                Value = h
            };
            ((Core.ParseHandling.Elements.Player.ImgUrl)domain.Elements.FirstOrDefault(e => e.InternalName == "ImgUrl")).Value = new StringValue {
                Value = imgUrl
            };
            ((Core.ParseHandling.Elements.Player.MarketValue)domain.Elements.FirstOrDefault(e => e.InternalName == "MV")).Value = new DecimalValue {
                Value = mv
            };
            ((Core.ParseHandling.Elements.Player.Name)domain.Elements.FirstOrDefault(e => e.InternalName == "Name")).Value = new StringValue {
                Value = name
            };
            ((Core.ParseHandling.Elements.Player.Nationality)domain.Elements.FirstOrDefault(e => e.InternalName == "Nat")).Value = new NationalityValue {
                Value = nat
            };
            ((Core.ParseHandling.Elements.Player.Position)domain.Elements.FirstOrDefault(e => e.InternalName == "Pos")).Value = new PositionValue {
                Value = pos
            };
            ((Core.ParseHandling.Elements.Player.PreferredFoot)domain.Elements.FirstOrDefault(e => e.InternalName == "Foot")).Value = new FootValue {
                Value = foot
            };
            ((Core.ParseHandling.Elements.Player.ProfileUrl)domain.Elements.FirstOrDefault(e => e.InternalName == "ProfileUrl")).Value = new StringValue {
                Value = profileUrl
            };
            ((Core.ParseHandling.Elements.Player.ShirtNumber)domain.Elements.FirstOrDefault(e => e.InternalName == "#")).Value = new IntValue {
                Value = number
            };
            ((Core.ParseHandling.Elements.Player.ShortName)domain.Elements.FirstOrDefault(e => e.InternalName == "ShortName")).Value = new StringValue {
                Value = shortName
            };

            return(domain);
        }
Пример #20
0
 public ForceStartingColumnForFootRule(Foot foot, int column)
 {
     this.foot   = foot;
     this.column = column;
 }
Пример #21
0
 /// <summary>
 /// Called from <see cref="FirstPersonWeaponHandler"/> in order to forward the event.
 /// This essentially is bound to <see cref="EntityModel.footstep"/>.
 /// </summary>
 public void OnFootstep(Foot foot)
 {
     this.footstep.Fire(foot);
 }
Пример #22
0
		// Initiate the feet
		private Transform[] InitiateFeet(IK[] ikComponents, ref Foot[] f, int indexOffset) {
			Transform[] bones = new Transform[ikComponents.Length];
			
			for (int i = 0; i < ikComponents.Length; i++) {
				IKSolver.Point[] points = ikComponents[i].GetIKSolver().GetPoints();
				
				f[i + indexOffset] = new Foot(ikComponents[i].GetIKSolver(), points[points.Length - 1].transform);
				bones[i] = f[i + indexOffset].transform;
				
				// Add to the update delegates of each ik solver
				f[i + indexOffset].solver.OnPreUpdate += OnSolverUpdate;
				f[i + indexOffset].solver.OnPostUpdate += OnPostSolverUpdate;
			}
			
			return bones;
		}
Пример #23
0
		// Set the IK position and weight for a limb
		private void SetFootIK(Foot foot, float maxOffset) {
			Vector3 direction = foot.leg.IKPosition - foot.transform.position;
			
			foot.solver.IKPosition = foot.transform.position + Vector3.ClampMagnitude(direction, maxOffset);
			foot.solver.IKPositionWeight = weight;
		}
Пример #24
0
    public void CreatePath(Foot foot)
    {
        path.Clear();
        foot.path.Clear();
        path.Add(new PathNode(foot.oldPos, 0));
        foot.x = new AnimationCurve();
        foot.y = new AnimationCurve();

        Vector2      dirToDestination, newDir, oldPoint = foot.oldPos, newPoint;
        float        distToDestination;
        RaycastHit2D hit;
        int          iterations = 0, maxIterations = 1000;

        while (Physics2D.Raycast(path[path.Count - 1].point, (foot.newPos - path[path.Count - 1].point).normalized, Vector2.Distance(path[path.Count - 1].point, foot.newPos), groundMask))
        {
            iterations++;
            if (iterations >= maxIterations || path[path.Count - 1].point == foot.newPos)
            {
                break;
            }
            dirToDestination  = (foot.newPos - path[path.Count - 1].point).normalized;
            distToDestination = Vector2.Distance(path[path.Count - 1].point, foot.newPos);
            hit = Physics2D.Raycast(path[path.Count - 1].point, dirToDestination, distToDestination, groundMask);
            if (hit.collider)
            {
                newPoint = hit.point;
                for (int i = 0; i < 100; i++)
                {
                    oldPoint = newPoint;
                    newDir   = Quaternion.Euler(0, 0, 5f) * dirToDestination;
                    hit      = Physics2D.Raycast(path[path.Count - 1].point, dirToDestination, distToDestination, groundMask);
                    if (hit.collider)
                    {
                        if ((hit.point - foot.newPos).sqrMagnitude > 0.01f)
                        {
                            newPoint = hit.point + new Vector2(0, legLiftOverObject);
                        }
                        else
                        {
                            newPoint = foot.newPos;
                            oldPoint = foot.newPos;
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            path.Add(new PathNode(oldPoint, Vector2.Distance(path[path.Count - 1].point, oldPoint)));
        }
        if (path.Count == 1)
        {
            path.Add(new PathNode(foot.newPos, Vector2.Distance(foot.oldPos, foot.newPos)));
        }

        print(path.Count);
        float totalDist = 0;
        float points    = 0;

        if (path.Count > 1)
        {
            foreach (PathNode p in path)
            {
                totalDist += p.distance;
            }
            for (int i = 0; i < path.Count; i++)
            {
                path[i].percentOfPath = path[i].distance / totalDist;
                points += path[i].percentOfPath;
                path[i].percentPointInPath = points;
            }
        }
        foot.path = path;
        if (foot.path.Count > 0)
        {
            for (int i = 0; i < foot.path.Count; i++)
            {
                PathNode p = foot.path[i];
                foot.x.AddKey(new Keyframe(p.percentPointInPath, p.point.x));
                foot.y.AddKey(new Keyframe(p.percentPointInPath, p.point.y));
            }
            for (int i = 0; i < foot.x.keys.Length; i++)
            {
                foot.x.SmoothTangents(i, 0);
            }
            for (int i = 0; i < foot.y.keys.Length; i++)
            {
                foot.y.SmoothTangents(i, 0);
            }
        }
    }
Пример #25
0
        private void EndTrails(int numTrails)
        {
            if (numTrails > 0 && flag == Flag.Invalid)
            {
                flag = Flag.Trail;
            }

            if (footHeld == Foot.Left && numTrails > 0)
            {
                // end the trail on the left foot
                beats[(int)leftFoot] = Note.Trail;
                footHeld             = Foot.None;
            }
            else if (footHeld == Foot.Right && numTrails > 0)
            {
                // end the trail on the right foot
                beats[(int)rightFoot] = Note.Trail;
                footHeld = Foot.None;
            }
            else if (footHeld == Foot.Both && numTrails > 1)
            {
                // end the trails on both feet
                beats[(int)leftFoot]  = Note.Trail;
                beats[(int)rightFoot] = Note.Trail;
                footHeld = Foot.None;
            }
            else if (footHeld == Foot.Both && numTrails == 1)
            {
                // for now, simply find the longer trail and end that
                Step temp = prev;
                while (temp.footHeld == Foot.Both)
                {
                    temp = prev.prev;
                }

                if (temp.footHeld == Foot.Left)
                {
                    footHeld = Foot.Right;
                }
                else if (temp.footHeld == Foot.Right)
                {
                    footHeld = Foot.Left;
                }
                else if (temp.footMoved == Foot.Left)
                {
                    footHeld = Foot.Right;
                }
                else if (temp.footMoved == Foot.Right)
                {
                    footHeld = Foot.Left;
                }
                else
                {
                    switch (temp.GetLastFootMoved())
                    {
                    case Foot.Left:
                        footHeld = Foot.Right;
                        break;

                    case Foot.Right:
                        footHeld = Foot.Left;
                        break;

                    default:
                        // always start with the left foot
                        footHeld = Foot.Right;
                        break;
                    }
                }

                // now, which trail are we ending?
                if (footHeld == Foot.Left)
                {
                    beats[(int)rightFoot] = Note.Trail;
                }
                else
                {
                    beats[(int)leftFoot] = Note.Trail;
                }
            }
        }
Пример #26
0
        public Step NextStep(Options opt, Random rand, int[] notes)
        {
            if (next != null)
            {
                throw new Exception("Error: Next Step already created!");
            }
            next = new Step(this);

            // end any trails, even if we didn't move the player
            next.EndTrails(notes[(int)Note.Trail]);

            // now, see if we're adding a special type of step
            switch (notes[(int)Note.Step] + notes[(int)Note.Hold] + notes[(int)Note.Roll])
            {
            case 0:
                // we don't need to move the player
                break;

            // we're just adding a random kind of step based on the Options
            case 1:
                Foot lastFoot = GetLastFootMoved();
                // are we in a 180 crossover position?
                if (leftFoot == Pos.Right && rightFoot == Pos.Left)
                {
                    //TODO 180s not supported yet
                    throw new Exception();
                }
                // always follow a crossover with a drill, unless we're doing a 180
                else if ((lastFoot == Foot.Left && leftFoot == Pos.Right) ||
                         (lastFoot == Foot.Right && rightFoot == Pos.Left))
                {
                    if (rand.Next() % 100 < opt.cross180Chance)
                    {
                        next.Move(Flag.Cross180, rand, notes);
                    }
                    else
                    {
                        next.Move(Flag.Drill, rand, notes);
                    }
                }
                // always follow up a jump with a double tap
                else if (flag == Flag.Jump)
                {
                    next.Move(Flag.DoubleTap, rand, notes);
                }
                // any arrow can be a drill (same as arrow before last) or double tap (same as last)
                else if (rand.Next() % 100 < opt.drillChance)
                {
                    next.Move(Flag.Drill, rand, notes);
                }
                // make sure we never have more than one double-tap in a row though
                else if (flag != Flag.DoubleTap && rand.Next() % 100 < opt.doubleTapChance)
                {
                    next.Move(Flag.DoubleTap, rand, notes);
                }
                // if we're in the right position, we can try for a crossover
                else if (((lastFoot == Foot.Left && (leftFoot == Pos.Down || leftFoot == Pos.Up) && rightFoot != Pos.Left) ||
                          (lastFoot == Foot.Right && (rightFoot == Pos.Down || rightFoot == Pos.Up) && leftFoot != Pos.Right)) &&
                         rand.Next() % 100 < opt.crossoverChance)
                {
                    next.Move(Flag.Crossover, rand, notes);
                }
                // if we're in the right position, we can try for a candle
                else if (((lastFoot == Foot.Left && leftFoot == Pos.Left &&
                           (rightFoot == Pos.Down || rightFoot == Pos.Up)) ||
                          (lastFoot == Foot.Right && rightFoot == Pos.Right &&
                           (leftFoot == Pos.Down || leftFoot == Pos.Up))) &&
                         rand.Next() % 100 < opt.candleChance)
                {
                    next.Move(Flag.Candle, rand, notes);
                }
                // only if no other option was picked do we want to create a normal arrow
                else
                {
                    next.Move(Flag.Normal, rand, notes);
                }
                break;

            // we're adding a Jump step (two arrows at once)
            default:
                // create a random jump step
                next.Move(Flag.Jump, rand, notes);
                break;
            }

            // make sure the step is properly created before sending it off
            next.Validate();
            return(next);
        }
Пример #27
0
 public webBrowser(Foot a_Match)
 {
     InitializeComponent();
     test.Source = new Uri(a_Match.lienVideo);
 }
Пример #28
0
 public PanelHistoryItem(int[] panel, Foot foot)
 {
     this.panel = panel;
     this.foot  = foot;
 }
Пример #29
0
 public PlayerBuilder WithFoot(Foot foot)
 {
     _playerFoot = foot;
     return(this);
 }
Пример #30
0
    //void Swing ()
    //{
    //    foot0.swingProgress += currentSwingSpeed * Time.deltaTime;
    //    if (foot0.swingProgress >= 1f)
    //    {
    //        foot0.position = foot0.swingTarget;
    //        NextFoot ();
    //        isMoving = false;
    //    }
    //    else
    //    {
    //        //foot0.position = foot0.swingTarget - foot0.swingVector * (1f - foot0.swingProgress) +
    //        //	Vector3.up * strideHeight * foot0.swingHeight;
    //    }
    //}
    void NextFoot()
    {
        Foot foot = foot0;
        foot0 = foot1;
        foot1 = foot;

        //isMoving = false;
    }
Пример #31
0
        /// <summary>
        /// Gets an panel history index before the specified current index that does not match the specified current foot
        /// </summary>
        public static int GetIndexOfLastFoot(IList <PanelHistoryItem> history, int currentIndex, Foot currentFoot)
        {
            while (currentIndex >= 0 && history[currentIndex].foot == currentFoot)
            {
                currentIndex--;
            }

            return(currentIndex);
        }
Пример #32
0
 private void SpawnFootstep(Foot foot)
 {
 }
Пример #33
0
 public FootSlot(Foot item) : base(item)
 {
 }
Пример #34
0
 public Point2D(Vector2 screenP, SimpleEventType eType, Foot f)
 {
     screenPoint = screenP;
     eventType   = eType;
     foot        = f;
 }
Пример #35
0
        protected virtual void Move(Flag stepFlag, Random rand, int[] notes)
        {
            // make sure the previous step is valid, because it must!
            if (prev == null)
            {
                throw new Exception();
            }
            prev.Validate();
            // also make sure this step hasn't already been initialized yet
            if (flag != Flag.Invalid && flag != Flag.Trail && flag != Flag.Jump)
            {
                throw new Exception();
            }
            flag = stepFlag;

            // what kind of step are we adding?
            switch (flag)
            {
            // a normal, non-candle, non-drill, simple flowing step
            case Flag.Normal:
                // which foot moved last?
                switch (prev.GetLastFootMoved())
                {
                // last foot to move was the left foot
                case Foot.Left:
                    // alternate to the right foot
                    footMoved = Foot.Right;
                    // is the right foot to be moving from the right arrow?								xxxR
                    if (rightFoot == Pos.Right)
                    {
                        // is the left foot on the left arrow?											L00R
                        if (leftFoot == Pos.Left)
                        {
                            // move the right foot to either the up or down arrow
                            rightFoot = rand.Next() % 2 == 0 ? Pos.Down : Pos.Up;
                        }
                        // if the left foot's on the up arrow, move right to down arrow					00LR
                        else if (leftFoot == Pos.Up)
                        {
                            rightFoot = Pos.Down;
                        }
                        // if the left foot's on the down arrow, move right to up arrow					0L0R
                        else if (leftFoot == Pos.Down)
                        {
                            rightFoot = Pos.Up;
                        }
                        else
                        {
                            // something is terribly wrong
                            throw new Exception();
                        }
                    }
                    // is the right foot to be moving from the up or down arrow?						xRRx
                    else if (rightFoot == Pos.Down || rightFoot == Pos.Up)
                    {
                        // the only choice is to move to the right arrow, since this isn't a candle
                        rightFoot = Pos.Right;
                    }
                    // is the right foot on the left arrow (i.e. we just finished a crossover)?			Rxxx
                    else
                    {
                        // to complete the crossover without adding a candle, move across from the left foot
                        if (leftFoot == Pos.Down)                                                                                                                                                // R0L0
                        {
                            rightFoot = Pos.Up;
                        }
                        else if (leftFoot == Pos.Up)                                                                                                                                     // RL00
                        {
                            rightFoot = Pos.Down;
                        }
                        else
                        {
                            // we must have just finished a full 180 crossover							R00L
                            // TODO - 180s not implemented yet
                            throw new Exception();
                        }
                    }
                    break;

                // last foot to move was the right foot
                case Foot.Right:
                    // alternate to the left foot
                    footMoved = Foot.Left;
                    // is the left foot to be moving from the left arrow?								Lxxx
                    if (leftFoot == Pos.Left)
                    {
                        // is the right foot on the right arrow?										L00R
                        if (rightFoot == Pos.Right)
                        {
                            // move the left foot to either the up or down arrow
                            leftFoot = rand.Next() % 2 == 0 ? Pos.Down : Pos.Up;
                        }
                        // if the right foot's on the up arrow, move left to down arrow					L0R0
                        else if (rightFoot == Pos.Up)
                        {
                            leftFoot = Pos.Down;
                        }
                        // if the right foot's on the down arrow, move left to up arrow					LR00
                        else if (rightFoot == Pos.Down)
                        {
                            leftFoot = Pos.Up;
                        }
                        else
                        {
                            // something is terribly wrong
                            throw new Exception();
                        }
                    }
                    // is the left foot to be moving from the up or down arrow?							xLLx
                    else if (leftFoot == Pos.Down || leftFoot == Pos.Up)
                    {
                        // the only choice is to move to the left arrow, since this isn't a candle
                        leftFoot = Pos.Left;
                    }
                    // is the left foot on the right arrow (i.e. we just finished a crossover)?			xxxL
                    else
                    {
                        // to complete the crossover without adding a candle, move across from the right foot
                        if (rightFoot == Pos.Down)                                                                                                                                               // 00RL
                        {
                            leftFoot = Pos.Up;
                        }
                        else if (rightFoot == Pos.Up)                                                                                                                                    // 0R0L
                        {
                            leftFoot = Pos.Down;
                        }
                        else
                        {
                            // we must have just finished a full 180 crossover							R00L
                            // TODO - 180s not implemented yet
                            throw new Exception();
                        }
                    }
                    break;

                // last foot to move was ambiguous or nonexistent
                default:
                    // always start with the left foot for consistency
                    footMoved = Foot.Left;
                    leftFoot  = Pos.Left;
                    break;
                }
                break;

            // a jump step, or two arrows at once
            case Flag.Jump:
                Foot lastFoot = prev.GetLastFootMoved();
                // first determine how many feet should move with this jump (0-2)
                if (rand.Next() % 100 < 10
                    // if we're recovering from a crossover position, definitely stick with the zero jump
                    || (lastFoot == Foot.Left && prev.leftFoot == Pos.Right) ||
                    (lastFoot == Foot.Right && prev.rightFoot == Pos.Left))
                {
                    // neither foot will move... still switch feet for the next step/jump though
                    if (lastFoot == Foot.Left)
                    {
                        footMoved = Foot.Right;
                    }
                    else
                    {
                        footMoved = Foot.Left;
                    }
                }
                // only move both feet at once for the jump if the last step was a jump too
                else if (prev.flag == Flag.Jump && rand.Next() % 100 < 10
                         // don't allow left-right to up-down jumps (ambiguous)
                         && !(leftFoot == Pos.Left && rightFoot == Pos.Right))
                {
                    // both feet will move simultaneously across the pad (only one option per setup)
                    if (leftFoot == Pos.Left && rightFoot == Pos.Down)                                                                                           // LR00
                    {
                        leftFoot  = Pos.Up;
                        rightFoot = Pos.Right;
                    }
                    else if (leftFoot == Pos.Left && rightFoot == Pos.Up)                                                                                // L0R0
                    {
                        leftFoot  = Pos.Down;
                        rightFoot = Pos.Right;
                    }
                    else if (leftFoot == Pos.Up && rightFoot == Pos.Right)                                                                               // 00LR
                    {
                        leftFoot  = Pos.Left;
                        rightFoot = Pos.Down;
                    }
                    else if (leftFoot == Pos.Down && rightFoot == Pos.Right)                                                                             // 0L0R
                    {
                        leftFoot  = Pos.Left;
                        rightFoot = Pos.Up;
                    }
                    else                                                                                                                                                                 // 0LR0 or 0RL0
                    {
                        leftFoot  = Pos.Left;
                        rightFoot = Pos.Right;
                    }

                    // still switch feet for the next step/jump
                    if (prev.GetLastFootMoved() == Foot.Left)
                    {
                        footMoved = Foot.Right;
                    }
                    else
                    {
                        footMoved = Foot.Left;
                    }
                }
                else
                {
                    // occasionally throw in a candle-jump if we're in the right position
                    if (((lastFoot == Foot.Left && prev.leftFoot == Pos.Left &&
                          (prev.rightFoot == Pos.Down || prev.rightFoot == Pos.Up)) ||
                         (lastFoot == Foot.Right && prev.rightFoot == Pos.Right &&
                          (prev.leftFoot == Pos.Down || prev.leftFoot == Pos.Up))) &&
                        rand.Next() % 100 < 50)
                    {
                        Move(Flag.Candle, rand, notes);
                    }
                    else
                    {
                        Move(Flag.Normal, rand, notes);
                    }
                    // reset the flag to a jump because we actually did a jump, not a step
                    flag = Flag.Jump;
                }
                break;

            // a drill step
            case Flag.Drill:
                // repeat the step before last
                switch (prev.GetLastFootMoved())
                {
                // if the last step was with the left, this one will be with the right
                case Foot.Left:
                    footMoved = Foot.Right;
                    break;

                // if the last step was with the right, this one will be with the left
                case Foot.Right:
                    footMoved = Foot.Left;
                    break;

                default:
                    // pick a random foot and go with it
                    footMoved = Foot.Left;                                    // rand.Next() % 2 == 0 ? Foot.Left : Foot.Right; //TEST
                    break;
                }
                break;

            // a candle
            case Flag.Candle:
                // figure out which foot moved last
                switch (prev.GetLastFootMoved())
                {
                // if the last step was with the left, this one will be with the right
                case Foot.Left:
                    footMoved = Foot.Right;
                    // move the right foot across the pad
                    if (rightFoot == Pos.Down)
                    {
                        rightFoot = Pos.Up;
                    }
                    else if (rightFoot == Pos.Up)
                    {
                        rightFoot = Pos.Down;
                    }
                    else if (rightFoot == Pos.Left)                                     // we must have just finished a crossover
                    {
                        rightFoot = Pos.Right;
                    }
                    else
                    {
                        // this should never happen
                        throw new Exception("ERROR: Invalid Candle Starting Position!");
                    }
                    break;

                // if the last step was with the right, this one will be with the left
                case Foot.Right:
                    footMoved = Foot.Left;
                    // move the left foot across the pad
                    if (leftFoot == Pos.Down)
                    {
                        leftFoot = Pos.Up;
                    }
                    else if (leftFoot == Pos.Up)
                    {
                        leftFoot = Pos.Down;
                    }
                    else if (leftFoot == Pos.Right)                                     // we must have just finished a crossover
                    {
                        leftFoot = Pos.Left;
                    }
                    else
                    {
                        // this should never happen
                        throw new Exception("ERROR: Invalid Candle Starting Position!");
                    }
                    break;

                default:
                    // we cannot do a candle for an ambiguous step (for now at least?)
                    throw new Exception("ERROR: Candle cannot follow an ambiguous step!");
                }
                break;

            // a double-tap step
            case Flag.DoubleTap:
                // repeat the last step without moving the foot
                footMoved = prev.GetLastFootMoved();
                // if the left foot's holding a trail, only move the right foot
                if (footHeld == Foot.Left)
                {
                    footMoved = Foot.Right;
                }
                // if the right foot's holding a trail, only move the left foot
                else if (footHeld == Foot.Right)
                {
                    footMoved = Foot.Left;
                }
                // both feet should not be held at this point
                else if (footHeld == Foot.Both)
                {
                    throw new Exception("ERROR: Hand step not handled properly");
                }
                // if the last step was ambiguous, always start with the left foot
                else if (footMoved != Foot.Left && footMoved != Foot.Right)
                {
                    footMoved = Foot.Left;
                }
                break;

            // a crossover
            case Flag.Crossover:
                switch (prev.GetLastFootMoved())
                {
                case Foot.Left:
                    // move the right foot to the left arrow
                    footMoved = Foot.Right;
                    rightFoot = Pos.Left;
                    break;

                case Foot.Right:
                    // move the left foot to the right arrow
                    footMoved = Foot.Left;
                    leftFoot  = Pos.Right;
                    break;

                default:
                    // this should never happen!
                    throw new Exception();
                }
                break;

            // TODO
            case Flag.Cross180:
                // TODO - 180 crossovers not implemented yet
                throw new Exception();

            default:
                // this should never happen
                throw new Exception("ERROR: Unhandled Step Flag");
            }

            // add the beats
            if (flag == Flag.Jump)
            {
                Note leftFootType  = Note.Step;
                Note rightFootType = Note.Step;
                // what combination of arrow types do we have?
                if (notes[(int)Note.Hold] == 1 && notes[(int)Note.Roll] == 0)
                {
                    // there's a hold on one foot... make it the foot moved
                    if (footMoved == Foot.Left)
                    {
                        leftFootType = Note.Hold;
                        footHeld     = Foot.Left;
                    }
                    else if (footMoved == Foot.Right)
                    {
                        rightFootType = Note.Hold;
                        footHeld      = Foot.Right;
                    }
                    else
                    {
                        // this should never happen
                        throw new Exception();
                    }
                }
                else if (notes[(int)Note.Hold] == 0 && notes[(int)Note.Roll] == 1)
                {
                    // there's a roll on one foot... make it the foot moved
                    if (footMoved == Foot.Left)
                    {
                        leftFootType = Note.Roll;
                        footHeld     = Foot.Left;
                    }
                    else if (footMoved == Foot.Right)
                    {
                        rightFootType = Note.Roll;
                        footHeld      = Foot.Right;
                    }
                    else
                    {
                        // this should never happen
                        throw new Exception();
                    }
                }
                else if (notes[(int)Note.Hold] > 0 && notes[(int)Note.Roll] > 0)
                {
                    // there's a hold AND a roll... make the hold the foot moved
                    footHeld = Foot.Both;
                    if (footMoved == Foot.Left)
                    {
                        leftFootType  = Note.Hold;
                        rightFootType = Note.Roll;
                    }
                    else if (footMoved == Foot.Right)
                    {
                        leftFootType  = Note.Roll;
                        rightFootType = Note.Hold;
                    }
                    else
                    {
                        // this should never happen
                        throw new Exception();
                    }
                }
                else if (notes[(int)Note.Hold] > 1)
                {
                    // two holds
                    footHeld      = Foot.Both;
                    leftFootType  = Note.Hold;
                    rightFootType = Note.Hold;
                }
                else if (notes[(int)Note.Roll] > 1)
                {
                    // two rolls
                    footHeld      = Foot.Both;
                    leftFootType  = Note.Roll;
                    rightFootType = Note.Roll;
                }

                // add the beats to the chart
                beats[(int)leftFoot]  = leftFootType;
                beats[(int)rightFoot] = rightFootType;
            }
            else if (footMoved == Foot.Left)
            {
                // make sure to add the right type of arrow (and start a hold if needed)
                if (notes[(int)Note.Hold] > 0)
                {
                    beats[(int)leftFoot] = Note.Hold;
                    if (footHeld == Foot.None)
                    {
                        footHeld = Foot.Left;
                    }
                    else
                    {
                        footHeld = Foot.Both;
                    }
                }
                else if (notes[(int)Note.Roll] > 0)
                {
                    beats[(int)leftFoot] = Note.Roll;
                    if (footHeld == Foot.None)
                    {
                        footHeld = Foot.Left;
                    }
                    else
                    {
                        footHeld = Foot.Both;
                    }
                }
                else
                {
                    beats[(int)leftFoot] = Note.Step;
                }
            }
            else if (footMoved == Foot.Right)
            {
                // make sure to add the right type of arrow (and start a hold if needed)
                if (notes[(int)Note.Hold] > 0)
                {
                    beats[(int)rightFoot] = Note.Hold;
                    if (footHeld == Foot.None)
                    {
                        footHeld = Foot.Right;
                    }
                    else
                    {
                        footHeld = Foot.Both;
                    }
                }
                else if (notes[(int)Note.Roll] > 0)
                {
                    beats[(int)rightFoot] = Note.Roll;
                    if (footHeld == Foot.None)
                    {
                        footHeld = Foot.Right;
                    }
                    else
                    {
                        footHeld = Foot.Both;
                    }
                }
                else
                {
                    beats[(int)rightFoot] = Note.Step;
                }
            }
            else
            {
                // for now this should never happen
                throw new Exception();
            }
            // and this should never happen either (unless I add Footswitches later)
            if (leftFoot == rightFoot)
            {
                throw new Exception();
            }
        }
Пример #36
0
 public void DeleteFoot()
 {
     Foot?.Remove();
 }