Esempio n. 1
0
 void DrawBodyPart(BodyParts bp)
 {
     Graphics g = panel1.CreateGraphics();
     Pen p = new Pen(Color.Blue, 2);
     if (bp == BodyParts.Head)
         g.DrawEllipse(p, 40, 50, 40, 40);
     else if (bp == BodyParts.Left_Eye)
     {
         SolidBrush s = new SolidBrush(Color.Black);
         g.FillEllipse(s, 50, 60, 5, 5);
     }
     else if (bp == BodyParts.Right_Eye)
     {
         SolidBrush s = new SolidBrush(Color.Black);
         g.FillEllipse(s, 63, 60, 5, 5);
     }
     else if (bp == BodyParts.Mouth)
     {
         g.DrawArc(p, 50, 60, 20, 20, 45, 90);
     }
     else if (bp == BodyParts.Body)
         g.DrawLine(p, new Point(60, 90), new Point(60, 170));
     else if (bp == BodyParts.Left_Arm)
         g.DrawLine(p, new Point(60, 100), new Point(30, 85));
     else if (bp == BodyParts.Right_Arm)
         g.DrawLine(p, new Point(60, 100), new Point(90, 85));
     else if (bp == BodyParts.Left_Leg)
         g.DrawLine(p, new Point(60, 170), new Point(30, 190));
     else if (bp == BodyParts.Right_Leg)
         g.DrawLine(p, new Point(60, 170), new Point(90, 190));
 }
Esempio n. 2
0
        /// <summary>
        /// Returns the creature armor for a body part
        /// </summary>
        public List <WorldObject> GetArmorLayers(Player target, BodyPart bodyPart)
        {
            //Console.WriteLine("BodyPart: " + bodyPart);
            //Console.WriteLine("===");

            var coverageMask = BodyParts.GetCoverageMask(bodyPart);

            var equipped = target.EquippedObjects.Values.Where(e => e is Clothing && (e.ClothingPriority & coverageMask) != 0).ToList();

            return(equipped);
        }
Esempio n. 3
0
        public void GetHit(BodyParts AttackedPart)
        {
            HitMethodsEventArgs args = new HitMethodsEventArgs();

            args.BodyId  = AttackedPart;
            args.TimeHit = DateTime.Now;

            LastInputBP = AttackedPart;

            OnHitMethods(args);
        }
Esempio n. 4
0
        void UpdateBodyPoint(BodyParts joint)
        {
            BodyPointPosition position = _KinectTAdapter.ReturnPosition(joint);

            if (joint == BodyParts.FootRight)
            {
                //infoText.text =("Posicion New "+position.name+": " + position.x + " " + position.y + " " + position.z + " ");
            }

            bodyPointsCollection[joint].setPosition(position);
        }
Esempio n. 5
0
        public void AddMesh(string bodyPartName, int groupid, Mesh mesh)
        {
            var g = BodyParts.FirstOrDefault(x => x.Name == bodyPartName);

            if (g == null)
            {
                g = new BodyPart(bodyPartName);
                BodyParts.Add(g);
            }
            g.AddMesh(groupid, mesh);
        }
Esempio n. 6
0
 public BodyPart(string name, int size, BodyParts part, Color color = new Color())
 {
     if (color == new Color())
     {
         color = Color.Black;
     }
     this.name  = name;
     this.size  = size;
     this.color = color;
     this.part  = part;
 }
Esempio n. 7
0
        /// <summary>
        /// Performs a melee attack for the monster
        /// </summary>
        /// <returns>The length in seconds for the attack animation</returns>
        public float MeleeAttack()
        {
            var player = AttackTarget as Player;

            if (player.Health.Current <= 0)
            {
                return(0.0f);
            }

            // choose a random combat maneuver
            var maneuver = GetCombatManeuver();

            if (maneuver == null)
            {
                return(0.0f);
            }

            AttackHeight = maneuver.AttackHeight;

            // select random body part @ current attack height
            var bodyPart = BodyParts.GetBodyPart(AttackHeight.Value);

            DoSwingMotion(AttackTarget, maneuver, out float animLength);
            PhysicsObj.stick_to_object(AttackTarget.PhysicsObj.ID);

            var actionChain = new ActionChain();

            actionChain.AddDelaySeconds(animLength / 2.0f);
            actionChain.AddAction(this, () =>
            {
                if (AttackTarget == null)
                {
                    return;
                }

                var critical   = false;
                var damageType = DamageType.Undef;
                var damage     = CalculateDamage(ref damageType, maneuver, bodyPart, ref critical);

                if (damage > 0.0f)
                {
                    player.TakeDamage(this, damageType, damage, bodyPart, critical);
                }
                else
                {
                    player.OnEvade(this, AttackType.Melee);
                }
            });
            actionChain.EnqueueChain();

            // TODO: figure out exact speed / delay formula
            NextAttackTime = Timer.CurrentTime + animLength + MeleeDelay;
            return(animLength);
        }
Esempio n. 8
0
        public void WriteData()
        {
            using (FileStream file = new FileStream("paramdb_gtc_eu.db", FileMode.Create, FileAccess.ReadWrite))
            {
                const uint DataTableCount = 0x24;
                file.WriteCharacters("GTAR");
                file.WriteUInt(DataTableCount);
                uint dataStart = ((DataTableCount + 2) * 4) + 16;
                file.WriteUInt(dataStart);
                file.WriteUInt(0x07);
                file.Position = dataStart;
                ushort tableNumber = 0;
                BrakeParts.Write(file, dataStart, tableNumber++);
                BrakeBalanceControllerParts.Write(file, dataStart, tableNumber++);
                SteeringParts.Write(file, dataStart, tableNumber++);
                ChassisParts.Write(file, dataStart, tableNumber++);
                WeightReductionParts.Write(file, dataStart, tableNumber++);
                BodyParts.Write(file, dataStart, tableNumber++);
                EngineParts.Write(file, dataStart, tableNumber++);
                PortPolishingParts.Write(file, dataStart, tableNumber++);
                EngineBalancingParts.Write(file, dataStart, tableNumber++);
                DisplacementIncreaseParts.Write(file, dataStart, tableNumber++);
                ComputerParts.Write(file, dataStart, tableNumber++);
                NATuneParts.Write(file, dataStart, tableNumber++);
                TurboKitParts.Write(file, dataStart, tableNumber++);
                DrivetrainParts.Write(file, dataStart, tableNumber++);
                FlywheelParts.Write(file, dataStart, tableNumber++);
                ClutchParts.Write(file, dataStart, tableNumber++);
                PropellerShaftParts.Write(file, dataStart, tableNumber++);
                GearboxParts.Write(file, dataStart, tableNumber++);
                SuspensionParts.Write(file, dataStart, tableNumber++);
                IntercoolerParts.Write(file, dataStart, tableNumber++);
                MufflerParts.Write(file, dataStart, tableNumber++);
                LSDParts.Write(file, dataStart, tableNumber++);
                TCSCParts.Write(file, dataStart, tableNumber++);
                ASCCParts.Write(file, dataStart, tableNumber++);
                WheelsParts.Write(file, dataStart, tableNumber++);
                TyreSizeParts.Write(file, dataStart, tableNumber++);
                TyreForceVolParts.Write(file, dataStart, tableNumber++);
                TyreCompounds.Write(file, dataStart, tableNumber++);
                TyresFrontParts.Write(file, dataStart, tableNumber++);
                TyresRearParts.Write(file, dataStart, tableNumber++);
                Opponents.Write(file, dataStart, tableNumber++);
                Events.Write(file, dataStart, tableNumber++);
                Regulations.Write(file, dataStart, tableNumber++);
                Courses.Write(file, dataStart, tableNumber++);
                ArcadeCars.Write(file, dataStart, tableNumber++);
                Cars.Write(file, dataStart, tableNumber++);

                file.Position = dataStart - 8;
                file.WriteUInt((uint)file.Length - dataStart);
            }
        }
Esempio n. 9
0
    private void AttachToPositionJointAndMiddleJointsTransformation(
        BodyParts bodyPartKey,
        BoneTransformation bodyPart)
    {
        JointId singleJoint         = bodyPart.joints[0];
        JointId middleJoint1        = bodyPart.joints[1];
        JointId middleJoint2        = bodyPart.joints[2];
        Vector3 singleJointPosition = jointCache[singleJoint].transformation.position;
        Vector3 middleJointPosition = (jointCache[middleJoint1].transformation.position + jointCache[middleJoint2].transformation.position) / 2.0f;

        bodyPart.bodyPart.position = (singleJointPosition + middleJointPosition) / 2.0f;
    }
Esempio n. 10
0
 private void SetBodyParts(BodyParts value)
 {
     EnsureEitherUsageExists();
     if (Usage != null)
     {
         Usage.BodyParts = value;
     }
     else if (Usage2 != null)
     {
         Usage2.BodyParts = value;
     }
 }
Esempio n. 11
0
        public ActiveInjury(IGameController gc, Type injuryType, BodyParts bodyPart, DateTime injuryTriggerTime)
        {
            _gc = gc;

            Injury            = (InjuryBase)Activator.CreateInstance(injuryType);
            BodyPart          = bodyPart;
            InjuryTriggerTime = injuryTriggerTime;

            _injuryTriggerTimeInitial = injuryTriggerTime;

            SetUpActiveStage(injuryTriggerTime);
        }
Esempio n. 12
0
            private void Start()
            {
                //se activa el freezerotation  en x y en z
                GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;

                StartCoroutineComport();

//se modifica el material por uno del generador
                GetComponent <Renderer>().material = Generator.riverSosPuto;

//se elige la edad
                if (data.age == 0)
                {
                    data.age = Random.Range(15, 101);
                }

                baseSpeed = (15f * baseSpeed) / data.age;

//se elije el numero al azar que representará al color elegido
                int colors = Random.Range(0, 3);

//se elige un gusto random
                gusto = (BodyParts)Random.Range(0, 5);

// se eleige el color según el random anterior
                switch (colors)
                {
                case 0:
                    data.zColor = Color.cyan;
                    GetComponent <Renderer>().material.color = data.zColor;
                    break;

                case 1:
                    data.zColor = (Color.green);
                    GetComponent <Renderer>().material.color = data.zColor;
                    break;

                case 2:
                    data.zColor = (Color.magenta);
                    GetComponent <Renderer>().material.color = data.zColor;
                    break;
                }

//se transforma la etiqueta y se añade un nombre
                transform.tag = "Zombie";

                niveau = (Hierarchy)Random.Range(0, 20);

                nivel = "" + niveau + "";

                transform.name = nivel;
            }
Esempio n. 13
0
            private void Start()
            {
                //el numero aleatorio del color que se elegirá
                int colors = Random.Range(0, 3);

                //añade el gusto
                gusto = (BodyParts)Random.Range(0, 5);

                //añade un color random
                switch (colors)
                {
                case 0:
                    data.zColor = Color.cyan;
                    GetComponent <Renderer>().material.color = data.zColor;
                    break;

                case 1:
                    data.zColor = (Color.green);
                    GetComponent <Renderer>().material.color = data.zColor;
                    break;

                case 2:
                    data.zColor = (Color.magenta);
                    GetComponent <Renderer>().material.color = data.zColor;
                    break;
                }

                //transforma la etiqueta
                transform.tag = "Zombie";

                //añade un nombre al zombie
                niveau = (Hierarchy)Random.Range(0, 5);

                string nivel = "" + niveau + "";

                data.gustoZombie = "Wrrar quiero " + gusto + ". Soy un " + niveau;
                transform.name   = nivel;

//inicia una corutina
                StartCoroutine("Comport");
//se elige la dirección de rotación
                switch (Random.Range(0, 2))
                {
                case 0:
                    directionRotate = "Right";
                    break;

                case 1:
                    directionRotate = "Left";
                    break;
                }
            }
Esempio n. 14
0
        public float CalculateDamage(WorldObject target, WorldObject damageSource, ref bool criticalHit)
        {
            // evasion chance
            var evadeChance = GetEvadeChance(target);

            if (Physics.Common.Random.RollDice(0.0f, 1.0f) < evadeChance)
            {
                return(0.0f);
            }

            // get weapon base damage
            var baseDamageRange = GetBaseDamage();
            var baseDamage      = Physics.Common.Random.RollDice(baseDamageRange.Min, baseDamageRange.Max);

            // get damage mods
            var powerAccuracyMod = GetPowerAccuracyMod();
            var attributeMod     = GetAttributeMod();
            var damage           = baseDamage * attributeMod * powerAccuracyMod;

            // critical hit
            var critical = 0.1f;

            if (Physics.Common.Random.RollDice(0.0f, 1.0f) < critical)
            {
                damage      = baseDamageRange.Max * attributeMod * powerAccuracyMod * 2.0f;
                criticalHit = true;
            }

            // get random body part @ attack height
            var bodyPart = BodyParts.GetBodyPart(AttackHeight);

            // get target armor
            var armor = GetArmor(target, bodyPart);

            // get target resistance
            DamageType damageType;

            if (damageSource?.ItemType == ItemType.MissileWeapon)
            {
                damageType = (DamageType)damageSource.GetProperty(PropertyInt.DamageType);
            }
            else
            {
                damageType = GetDamageType();
            }
            var resistance = GetResistance(target, bodyPart, damageType);

            // scale damage for armor
            damage *= SkillFormula.CalcArmorMod(resistance);

            return(damage);
        }
Esempio n. 15
0
        //here draw the body parts specified in the BodyParts enum
        void drawBodyPart(BodyParts bp)
        {
            Graphics g = panel1.CreateGraphics();
            Pen      p = new Pen(Color.Blue, 2);

            if (bp == BodyParts.Head)
            {
                g.DrawEllipse(p, 40, 50, 40, 40);
            }

            else if (bp == BodyParts.Left_Eye)
            {
                SolidBrush s = new SolidBrush(Color.Blue);
                g.FillEllipse(s, 50, 60, 5, 5);
            }

            else if (bp == BodyParts.Right_Eye)
            {
                SolidBrush s = new SolidBrush(Color.Blue);
                g.FillEllipse(s, 64, 60, 5, 5);
            }

            else if (bp == BodyParts.Mouth)
            {
                g.DrawArc(p, 50, 60, 20, 20, 45, 90);
            }

            else if (bp == BodyParts.Body)
            {
                g.DrawLine(p, new Point(60, 90), new Point(60, 170));
            }

            else if (bp == BodyParts.Left_Arm)
            {
                g.DrawLine(p, new Point(60, 110), new Point(30, 95));
            }

            else if (bp == BodyParts.Right_Arm)
            {
                g.DrawLine(p, new Point(60, 110), new Point(90, 95));
            }

            else if (bp == BodyParts.Left_Leg)
            {
                g.DrawLine(p, new Point(60, 170), new Point(30, 190));
            }

            else if (bp == BodyParts.Right_Leg)
            {
                g.DrawLine(p, new Point(60, 170), new Point(90, 190));
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Returns the creature armor for a body part
        /// </summary>
        public List <WorldObject> GetArmor(BodyPart bodyPart)
        {
            var target = AttackTarget as Creature;

            //Console.WriteLine("BodyPart: " + bodyPart);
            //Console.WriteLine("===");

            var bodyLocation = BodyParts.GetFlags(BodyParts.GetEquipMask(bodyPart));

            var equipped = target.EquippedObjects.Values.Where(e => e is Clothing && BodyParts.HasAny(e.CurrentWieldedLocation, bodyLocation)).ToList();

            return(equipped);
        }
Esempio n. 17
0
 private void Round(BodyParts ChoosedPart)
 {
     if (RoundCount % 2 != 0)
     {
         SecondPlayer.SetBlock();
         SecondPlayer.GetHit(ChoosedPart);
     }
     else
     {
         FirstPlayer.SetBlock(ChoosedPart);
         FirstPlayer.GetHit(FirstPlayer.CalculateAttackedPart());
     }
 }
Esempio n. 18
0
    public void DecreaseBodyPart()
    {
        if (bodies.Count > 0)
        {
            BodyParts lastBodyPart = bodies[bodies.Count - 1];
            Vector3   lastBodyPos  = lastBodyPart.transform.position;

            Destroy(lastBodyPart.gameObject);
            bodies.Remove(lastBodyPart);

            tail.transform.position = lastBodyPos;
        }
    }
Esempio n. 19
0
        string getBodyParts(BodyParts part)
        {
            switch (part)
            {
            case BodyParts.Head: return("голову ");

            case BodyParts.Body: return("тело ");

            case BodyParts.Legs: return("ноги ");

            default: return("Error 404");
            }
        }
Esempio n. 20
0
 private void RemoveBodyPart()
 {
     // If all body parts are removed
     if (BodyParts.First == null)
     {
         DeathAnimationTrigger.Threshold = 0;
         IsAlive = false;
     }
     else
     {
         BodyParts.RemoveFirst();
     }
 }
Esempio n. 21
0
        public static void getjoint(int SkeletonID, MapToCamera camera, BodyParts joint, out int x, out int y, out int z, bool sortID)
        {
            x = y = z = -1;
            if (myKin != null)
            {
                EnableSkeletonStream();

                if (_skeletons != null)
                {
                    if (sortID)
                    {
                        SkeletonID = _SelectTrackingSkeleton(SkeletonID);
                    }

                    if (SkeletonID != -1)
                    {
                        if (_skeletons[SkeletonID] != null)
                        {
                            SkeletonPoint point = _skeletons[SkeletonID].Joints[(JointType)joint].Position;
                            if (point.X != 0 && point.Y != 0 && point.Z != 0)
                            {
                                switch (camera)
                                {
                                case MapToCamera.Metric:
                                    x = Convert.ToInt32(point.X * 1000f);
                                    y = Convert.ToInt32(point.Y * 1000f);
                                    z = Convert.ToInt32(point.Z * 1000f);
                                    break;

                                case MapToCamera.Depth:
                                    DepthImagePoint dPoint0 = myKin.CoordinateMapper.MapSkeletonPointToDepthPoint(point, myKin.DepthStream.Format);
                                    x = dPoint0.X;
                                    y = dPoint0.Y;
                                    z = dPoint0.Depth;
                                    break;

                                case MapToCamera.Color:
                                    ColorImagePoint cPoint  = myKin.CoordinateMapper.MapSkeletonPointToColorPoint(point, myKin.ColorStream.Format);
                                    DepthImagePoint dPoint1 = myKin.CoordinateMapper.MapSkeletonPointToDepthPoint(point, myKin.DepthStream.Format);
                                    x = cPoint.X;
                                    y = cPoint.Y;
                                    z = dPoint1.Depth;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 22
0
        void OnKilled(TakeDamage takedamage, DamageEvent damage)
        {
            var tags = new Hash <string, string>();

            if (damage.attacker.client != null)
            {
                tags["weapon"]    = (damage.extraData is WeaponImpact) ? ((WeaponImpact)damage.extraData).dataBlock.name : "Unknown";
                tags["killer"]    = damage.attacker.client.userName;
                tags["killer-id"] = damage.attacker.client.userID.ToString();
                if (damage.victim.client != null)
                {
                    tags["killed"]    = damage.victim.client.userName;
                    tags["killed-id"] = damage.victim.client.userID.ToString();
                    if (damage.victim.client == damage.attacker.client)
                    {
                        if (suicide)
                        {
                            notifyDeath(tags, "suicideDeathMessage");
                        }
                        return;
                    }
                    else
                    {
                        if (player)
                        {
                            tags["distance"] = Math.Floor(Vector3.Distance(damage.victim.client.lastKnownPosition, damage.attacker.client.lastKnownPosition)).ToString();
                            tags["bodypart"] = BodyParts.GetNiceName(damage.bodyPart);
                            notifyDeath(tags, "playerDeathMessage");
                        }
                    }
                }
                else if (damage.victim.networkView != null && damage.victim.networkView.gameObject.GetComponent <HostileWildlifeAI>())
                {
                    HostileWildlifeAI hostileai = damage.victim.networkView.gameObject.GetComponent <HostileWildlifeAI>();
                    tags["distance"]  = Math.Floor(Vector3.Distance(damage.victim.networkView.position, damage.attacker.client.lastKnownPosition)).ToString();
                    tags["killed"]    = hostileai.gameObject.name.Replace("(Clone)", "").Replace("Mutant", "Mutant ").ToLower();
                    tags["killed-id"] = tags["killed"].Replace("mutant ", "");
                }
            }
            else if (damage.attacker.networkView != null && damage.attacker.networkView.gameObject.GetComponent <HostileWildlifeAI>())
            {
                HostileWildlifeAI hostileai = damage.attacker.networkView.gameObject.GetComponent <HostileWildlifeAI>();
                tags["killer"]    = hostileai.gameObject.name.Replace("(Clone)", "").Replace("Mutant", "Mutant ").ToLower();
                tags["killer-id"] = tags["killer"].Replace("mutant ", "");
                if (animals)
                {
                    notifyDeath(tags, "deathByAnimal");
                }
            }
        }
Esempio n. 23
0
 public void MakeStep(BodyParts _part)
 {
     if (Round % 2 == 0)
     {
         player2.MakeBlock();
         player2.GetHit(_part, ConstantFields.basicDamage);
     }
     else
     {
         player1.SetBlock(_part);
         player1.GetHit(player2.MakeHit(), ConstantFields.basicDamage);
     }
     Round++;
 }
Esempio n. 24
0
 void ChangePart(BodyParts b, bool increase)
 {
     b.bodyParts[b.currentIndex].SetActive(false);
     b.currentIndex += increase ? 1 : -1;
     if (b.currentIndex > b.bodyParts.Count - 1)
     {
         b.currentIndex = 0;
     }
     if (b.currentIndex < 0)
     {
         b.currentIndex = b.bodyParts.Count - 1;
     }
     b.bodyParts[b.currentIndex].SetActive(true);
     b.bodyNameDisplay.text = b.bodyParts[b.currentIndex].gameObject.name;
 }
Esempio n. 25
0
        void DrawBodyPart(BodyParts bp)
        {
            Graphics   g = panel1.CreateGraphics();
            Pen        p = new Pen(Color.Blue, 2);
            SolidBrush s = new SolidBrush(Color.Black);

            switch (bp)
            {
            case BodyParts.Head:
                g.DrawEllipse(p, 40, 50, 40, 40);
                break;

            case BodyParts.Left_Eye:
                g.FillEllipse(s, 50, 60, 5, 5);
                break;

            case BodyParts.Right_Eye:
                g.FillEllipse(s, 63, 60, 5, 5);
                break;

            case BodyParts.Mouth:
                g.DrawArc(p, 50, 75, 20, 20, 225, 90);
                break;

            case BodyParts.Right_Arm:
                g.DrawLine(p, new Point(60, 100), new Point(90, 85));
                break;

            case BodyParts.Left_Arm:
                g.DrawLine(p, new Point(60, 100), new Point(30, 85));
                break;

            case BodyParts.Body:
                g.DrawLine(p, new Point(60, 90), new Point(60, 170));
                break;

            case BodyParts.Right_Leg:
                g.DrawLine(p, new Point(60, 170), new Point(90, 190));
                break;

            case BodyParts.Left_Leg:
                g.DrawLine(p, new Point(60, 170), new Point(30, 190));
                break;

            default:
                break;
            }
        }
Esempio n. 26
0
        void DrawBodyPart(BodyParts bodyPart)
        {
            Graphics   g = panel1.CreateGraphics();
            Pen        p = new Pen(Color.Blue, 2);
            SolidBrush sb;

            switch (bodyPart)
            {
            case BodyParts.Head:
                g.DrawEllipse(p, 40, 58, 40, 40);     // Todo: adjust head!
                break;

            case BodyParts.LeftEye:
                sb = new SolidBrush(Color.Black);
                g.FillEllipse(sb, 50, 68, 5, 5);
                break;

            case BodyParts.RightEye:
                sb = new SolidBrush(Color.Black);
                g.FillEllipse(sb, 63, 68, 5, 5);
                break;

            case BodyParts.Mouth:
                g.DrawArc(p, 50, 69, 20, 20, 45, 90);
                break;

            case BodyParts.RightArm:
                g.DrawLine(p, new Point(60, 100), new Point(90, 85));
                break;

            case BodyParts.LeftArm:
                g.DrawLine(p, new Point(60, 100), new Point(30, 85));
                break;

            case BodyParts.Body:
                g.DrawLine(p, new Point(60, 90), new Point(60, 170));
                break;

            case BodyParts.Rightleg:
                g.DrawLine(p, new Point(60, 170), new Point(90, 190));
                break;

            case BodyParts.LeftLeg:
                g.DrawLine(p, new Point(60, 170), new Point(30, 190));
                break;
            }
            g.DrawLine(p, new Point(60, 170), new Point(60, 185));
        }
Esempio n. 27
0
 private void getNextFour()
 {
     pointerInArray = 0;
     // Generate the body parts
     for (int index = 0; index < 4; ++index)
     {
         currentTilesToDo[index].SetBodyPart((BodyParts)Random.Range(0, 4));
         //Get the body part that needs to be done
         BodyParts bp = (currentTilesToDo[index].GetBodyPart());
         //Put each in screen
         Debug.Log(keySettings[(int)bp].getLetter());
         //TODO HERE
         _boxes[index].SetPendingState(true);
         _boxes[index].SetBodyPart(currentTilesToDo[index].GetBodyPart());
     }
 }
Esempio n. 28
0
        // Данный метод дублирует определение дейсвтвия для игрока, сделан сугубо для примера абстракции
        // с расчетом на возможность добавления других действий игроку
        private void FighterAction(BasePlayer player, BodyParts part, RoundAction action)
        {
            switch (action)
            {
            case RoundAction.Attack:
                player.Hit(part);
                break;

            case RoundAction.Defend:
                player.Block(part);
                break;

            default:
                break;
            }
        }
Esempio n. 29
0
        private void CreateBody()
        {
            BodyPart head = CreateBodyPart(AreaWidth / 2 + (int)(AreaWidth / 2 % BodyPartSize) - Convert.ToInt32(BodyPartSize) * 2, AreaWidth / 2 + (int)(AreaWidth / 2 % BodyPartSize), BodyPartSize, HeadColor);
            BodyPart body = CreateBodyPart(AreaWidth / 2 + (int)(AreaWidth / 2 % BodyPartSize) - Convert.ToInt32(BodyPartSize), AreaWidth / 2 + (int)(AreaWidth / 2 % BodyPartSize), BodyPartSize, BodyColor);
            BodyPart tail = CreateBodyPart(AreaWidth / 2 + (int)(AreaWidth / 2 % BodyPartSize), AreaWidth / 2 + (int)(AreaWidth / 2 % BodyPartSize), BodyPartSize, BodyColor);

            BodyParts.Add(head);
            BodyParts.Add(body);
            BodyParts.Add(tail);

            Directions.AddFirst(SnakeDirections.Left);
            Directions.AddFirst(SnakeDirections.Left);
            Directions.AddFirst(SnakeDirections.Left);

            CurrentDirection = SnakeDirections.Left;
        }
Esempio n. 30
0
    private void Start()
    {
        thisSpinner = GameObject.FindGameObjectWithTag("Player");

        camTransform = cam.gameObject.transform;

        propDropDropdown.onValueChanged.AddListener(delegate
        {
            PropDropdownValueChanged(propDropDropdown);
        });

        envVariables = EnvironmentVariables.instance;
        bodyParts    = BodyParts.instance;

        //default value in this function is currently set to hoops if none is provided.
        SetSpinnerProps(SpinnerProps.None);
    }
Esempio n. 31
0
        void DrawBodyParts(BodyParts BP) // Creates body parts that will be revealed on a wrong guess
        {
            Graphics g = panel1.CreateGraphics();
            Pen      p = new Pen(Color.Black, 2);

            if (BP == BodyParts.Head)
            {
                g.DrawEllipse(p, 65, 50, 50, 50);
            }

            else if (BP == BodyParts.L_Eye)
            {
                SolidBrush s = new SolidBrush(Color.Black);
                g.FillEllipse(s, 77, 70, 5, 5);
            }
            else if (BP == BodyParts.R_Eye)
            {
                SolidBrush s = new SolidBrush(Color.Black);
                g.FillEllipse(s, 94, 70, 5, 5);
            }
            else if (BP == BodyParts.Mouth)
            {
                g.DrawArc(p, 77, 85, 25, 25, 225, 90);
            }
            else if (BP == BodyParts.Body)
            {
                g.DrawLine(p, new Point(90, 100), new Point(90, 188));
            }
            else if (BP == BodyParts.L_Arm)
            {
                g.DrawLine(p, new Point(90, 125), new Point(50, 110));
            }
            else if (BP == BodyParts.R_Arm)
            {
                g.DrawLine(p, new Point(90, 125), new Point(125, 110));
            }
            else if (BP == BodyParts.L_Leg)
            {
                g.DrawLine(p, new Point(90, 185), new Point(65, 230));
            }
            else if (BP == BodyParts.R_Leg)
            {
                g.DrawLine(p, new Point(89, 185), new Point(115, 230));
            }
        }
Esempio n. 32
0
 private void SetBodyParts(BodyParts value)
 {
     EnsureEitherUsageExists();
     if (Usage != null)
         Usage.BodyParts = value;
     else if (Usage2 != null)
         Usage2.BodyParts = value;
 }
Esempio n. 33
0
 /// <summary>
 /// Method that takes a Bodypart as parameter and then calls the attack method in the gameEngine object.
 /// Depending on return value the status of the monster is checked. The status of the player is always checked.
 /// </summary>
 /// <param name="bodypart"></param>
 private void AttackMonster(BodyParts bodypart)
 {
     if (gameEngine.HurtMonster(bodypart))
     {
         IndicateHealthReduction();
         UpdateGUI();
     }
     else
     {
         UpdateGUI();
         CheckIfMonsteIsDead();
         CheckIfMonsterRunAway();
         UpdateGUI();
     }
     CheckIfHeroIsDead();
 }
Esempio n. 34
0
 private IList<GearPiece> GetGearPiecesByBodyPart(BodyParts part, IList<GearPiece> pieces)
 {
     return pieces
         .Where(p => p.BodyPart == part)
     .OrderBy(o => o.Name)
         .ToList();
 }
Esempio n. 35
0
        /// <summary>
        /// Method that when called upon deals damage to the monster and the hero (player).
        /// If the health of the hero or the monsters body is bigger than zero the attack
        /// will take place.
        /// </summary>
        /// <param name="bodypart"></param>
        /// <returns>bool</returns>
        public bool HurtMonster(BodyParts bodypart)
        {
            bool isHeroAttackedBack = true;
            if (hero.Health > 0 || monster.Body > 0)
            {
                int heroDamage = hero.DoDamage();
                monster.TakeDamage(heroDamage, bodypart);
                scoreCount.DamageByHero(heroDamage);

                if(!HurtHero())
                {
                    isHeroAttackedBack = false;
                }
            }

            return isHeroAttackedBack;
        }
Esempio n. 36
0
        void DrawBodyParts(BodyParts bp)
        {
            Graphics g = panel1.CreateGraphics();
            Pen p = new Pen(Color.White, 2);
            if (bp == BodyParts.Head)
            {
                g.DrawEllipse(p, 40, 103, 60, 60);
            }
            else if (bp == BodyParts.Left_Eye)
            {
                SolidBrush s = new SolidBrush(Color.White);
                g.FillEllipse(s, 50, 125, 5, 5);
            }
            else if (bp == BodyParts.Right_Eye)
            {
                SolidBrush s = new SolidBrush(Color.White);
                g.FillEllipse(s, 85, 125, 5, 5);
            }
            else if (bp == BodyParts.Mouth)
            {
                g.DrawLine(p, new Point(53,150) , new Point(85,150));

            }
            else if (bp == BodyParts.Body)
            {
                g.DrawLine(p, new Point(70, 165) , new Point(70, 250));
            }
            else if (bp == BodyParts.Left_Arm)
            {
                g.DrawLine(p, new Point(70, 180), new Point(35, 235));
            }
            else if (bp == BodyParts.Right_Arm)
            {
                g.DrawLine(p, new Point(70,180), new Point(105, 235));
            }
            else if (bp == BodyParts.Left_Leg)
            {
                g.DrawLine(p, new Point(70, 250), new Point(55,290));
            }
            else if (bp == BodyParts.Right_Leg)
            {
                g.DrawLine(p, new Point(70,250), new Point(85, 290));
            }
        }