Пример #1
0
    public Part GetPart(PartTypes id)
    {
        Part element = null;

        _parts?.TryGetValue(id, out element);
        return(element);
    }
Пример #2
0
        public string PartTypeName(int typeID)
        {
            PartTypes    pt = _context.PartTypes.Where(r => r.PartTypeID == typeID).FirstOrDefault();
            PartCategory ct = _context.PartCategory.Where(c => c.PartCategoryID == pt.PartCategoryID).FirstOrDefault();

            return($"{ct.PartCategoryName.Trim()} - {pt.PartTypeName.Trim()}");
        }
Пример #3
0
        public static Texture2D GetTextureFromPartAndFacing(Facing facing, PartTypes partType)
        {
            Texture2D chosenTexture = null;

            chosenTexture = partTextureLookup[(int)partType][(int)facing];

            return(chosenTexture);
        }
Пример #4
0
 private bool TryGetEquipped(Car c, PartTypes type, out CarPart part)
 {
     if (c.equippedParts.TryGetValue(type, out part))
     {
         return(part != null);
     }
     return(false);
 }
Пример #5
0
        public void SetPartType(PartTypes part)
        {
            Texture2D up    = ResourceManager.GetTextureFromPartAndFacing(Facing.Up, part);
            Texture2D down  = ResourceManager.GetTextureFromPartAndFacing(Facing.Down, part);
            Texture2D left  = ResourceManager.GetTextureFromPartAndFacing(Facing.Left, part);
            Texture2D right = ResourceManager.GetTextureFromPartAndFacing(Facing.Right, part);

            SetTextures(up, down, left, right);
        }
Пример #6
0
 public LimbVisual(PartTypes part)
     : base()
 {
     facings    = new Texture2D[4];
     boundAreas = new Rectangle[4];
     depths     = new float[4];
     SetPartType(part);
     currentUpdate = Update_Nothing;
 }
        public Part(string RelativePath, PartTypes PartType)
        {
            string FullPath = RelativePath;

            switch (PartType)
            {
            case PartTypes.HeadAntena:
                FullPath = "Head/Antena/" + RelativePath;
                break;

            case PartTypes.HeadEars:
                FullPath = "Head/Ears/" + RelativePath;
                break;

            case PartTypes.HeadEyes:
                FullPath = "Head/Eyes/" + RelativePath;
                break;

            case PartTypes.HeadCPU:
                FullPath = "Head/CPU/" + RelativePath;
                break;

            case PartTypes.TorsoCore:
                FullPath = "Torso/Core/" + RelativePath;
                break;

            case PartTypes.TorsoRadiator:
                FullPath = "Torso/Radiator/" + RelativePath;
                break;
            }

            FileStream   FS = new FileStream("Content/Units/Modular/" + FullPath + ".pep", FileMode.Open, FileAccess.Read);
            BinaryReader BR = new BinaryReader(FS, Encoding.UTF8);

            BR.BaseStream.Seek(0, SeekOrigin.Begin);

            this.PartType    = PartType;
            this.FullName    = RelativePath;
            this.Description = BR.ReadString();
            this.Price       = BR.ReadInt32();

            this.BaseHP       = BR.ReadInt32();
            this.BaseEN       = BR.ReadInt32();
            this.BaseArmor    = BR.ReadInt32();
            this.BaseMobility = BR.ReadInt32();
            this.BaseMovement = BR.ReadSingle();

            this.MEL = BR.ReadInt32();
            this.RNG = BR.ReadInt32();
            this.DEF = BR.ReadInt32();
            this.SKL = BR.ReadInt32();
            this.EVA = BR.ReadInt32();
            this.HIT = BR.ReadInt32();

            FS.Close();
            BR.Close();
        }
Пример #8
0
    public CarPart RemovePart(PartTypes type)
    {
        CarPart removedPart = equippedParts[type];

        equippedParts[type] = null;
        UpdateComponentEffects();
        removedPart.isEquipped = false;
        return(removedPart);
    }
Пример #9
0
 public void AddPart(PartTypes type, CarPart newPart)
 {
     if (newPart.type != type)
     {
         Debug.Log($"Equipped {newPart.type}-slot part in {type} slot (probably shouldn't happen).");
     }
     equippedParts[type] = newPart;
     newPart.isEquipped  = true;
     UpdateComponentEffects();
 }
Пример #10
0
    public bool BuyUpgrade(PartTypes type, UpgradeController upgrade)
    {
        if (HasMoney(upgrade.Price))
        {
            _model.money -= upgrade.Price;
            GetPart(type).ApplyUpgrade(upgrade);
            return(true);
        }

        return(false);
    }
        public ProjectEternityPartEditor(string FilePath, object[] Params)
            : this()
        {
            this.FilePath = FilePath;
            this.PartType = (PartTypes)Params[0];
            if (!File.Exists(FilePath))
            {
                FileStream fs = File.Create(FilePath);
                fs.Close();
                SaveItem(FilePath, FilePath);
            }

            LoadPart(this.FilePath);
        }
Пример #12
0
    public Part(BoughtModel upgrade)
    {
        _type     = (PartTypes)upgrade.elementtype;
        _element  = ElementManager.Instance.GetController(upgrade.elementid);
        _upgrades = new List <UpgradeController>(_element.Upgrades);

        var boughtUpgrades = upgrade.upgrades ?? new int[0];

        foreach (var upgradeId in boughtUpgrades)
        {
            var upgradeController = UpgradeManager.Instance.GetController(upgradeId);
            ApplyUpgrade(upgradeController);
        }
    }
Пример #13
0
        public static void CreatePart(string partName, string partDescription, PartTypes partType, decimal price, decimal cost, string manufacturer, decimal length, decimal width, decimal height, decimal weight)
        {
            var part = new Part
            {
                Name         = partName,
                Description  = partDescription,
                PartType     = partType,
                Price        = price,
                Cost         = cost,
                Manufacturer = manufacturer,
                Length       = length,
                Width        = width,
                Height       = height,
                Weight       = weight
            };

            Parts.Add(part);
        }
Пример #14
0
    public CarPart Create(PartTypes type, Manufacturers manufacturer, Sprite sprite, Action <Car> setPartsDelegate)
    {
        CarPart newPart = Instantiate(carPartPrefab);

        newPart.type         = type;
        newPart.manufacturer = manufacturer;
        newPart.sprite       = sprite;
        newPart.UpdateEffect = setPartsDelegate ?? (_ => throw new System.NotImplementedException($"The part equipped in slot {type} is not implemented"));

        int hpVariance = UnityEngine.Random.Range(-50, 101);

        newPart.maxHealth     = 100 + hpVariance;
        newPart.currentHealth = 100 + hpVariance;
        newPart.healthDecay   = 1;
        //TODO: Set other stuff

        return(newPart);
    }
Пример #15
0
        public bodypart(ClassTypes ty, PartTypes pt, string name = " ",double str = 0, double def = 0, double intel = 0, double agil = 0, double end = 0)
        {
            Name = name;
            Abilities = new List<ability>();

            Class = ty;
            Part = pt;
            ClassPart = (ClassPartTypes)Enum.Parse(typeof(ClassPartTypes),Class.ToString() + Part.ToString());
            if (str + agil + def + intel + end != 0)
            {
                ability tempAbility = new ability("Base", new List<effect>()
                    {
                    new effect(Stats.statsType.STRENGTH, str, -1, false, true, " ", this.ClassPart),
                    new effect(Stats.statsType.AGILITY, agil, -1, false, true, " ", this.ClassPart),
                    new effect(Stats.statsType.INTELLIGENCE, intel, -1, false, true, " ", this.ClassPart),
                    new effect(Stats.statsType.ENDURANCE, end, -1, false, true, " ", this.ClassPart),
                    new effect(Stats.statsType.DEFENCE, def, -1, false, true, " ",this.ClassPart)
                    }, true, true, new mastery(), new Stats());
                this.AddAbility(tempAbility);
            }
        }
    public void ChangePartType(string newType)
    {
//		Debug.Log ("Part type changed to " + newType);
        foreach (PartTypes type in PartTypes.GetValues(typeof(PartTypes)))
        {
            if (newType == type.ToString())
            {
                partType = type;
            }
        }

        if (partButtons.Count != 0)
        {
            foreach (GameObject go in partButtons)
            {
                Destroy(go);
            }
            partButtons.Clear();
        }

        /*pathName = "Part Database/" + partType.ToString () + "s/0" + partType.ToString () + " List";
         * listAll = Resources.Load<PartList> (pathName);
         *
         * foreach (ScriptableObject so in listAll.allParts) {
         *      partButtons.Add ((GameObject)Instantiate (buttonBlank));
         *
         *      int a = partButtons.Count - 1;
         *      height = partButtons [a].GetComponent<RectTransform> ().rect.height;
         *
         *      partButtons [a].GetComponentInChildren<Text> ().text = (string) so.GetType().GetField("partName").GetValue(so);
         *      partButtons [a].transform.SetParent (transform, false);
         *      partButtons [a].GetComponent <RectTransform> ().anchoredPosition = new Vector3 (0, -(0.5f + a) * (spacing + height), 0);//
         *      GetComponent <RectTransform> ().sizeDelta = new Vector2 (0, (1 + a) * (spacing + height));
         *
         *      if (a == 0) {
         *              ChangePart (partButtons [a].GetComponentInChildren<Text> ().text);
         *      }
         * }*/
    }
Пример #17
0
 public ConstraintPart(string text)
 {
     this.PartType = PartTypes.General;
     this.Text     = text;
 }
Пример #18
0
 public ConstraintPart(PartTypes type, string text)
 {
     this.PartType = type;
     this.Text     = text;
 }
Пример #19
0
 public override bool IsCompatible(PartTypes type)
 {
     return(type == partType);
 }
Пример #20
0
 public CarPart Create(PartTypes type, Manufacturers manufacturer)
 {
     return(Create(type, manufacturer, sprites[type][manufacturer], callbacks[type][manufacturer]));
 }
Пример #21
0
 public virtual bool IsCompatible(PartTypes type)
 {
     return(true);
 }
Пример #22
0
        public override void Start()
        {
            base.Start();

            PartTypes theType = PartTypes.Torso;

            if (type == LimbComponentType.Head)
            {
                if (head == HeadSubType.Bite)
                {
                    theType = PartTypes.BiteHead;
                }
                else if (head == HeadSubType.Bomb)
                {
                    theType = PartTypes.BombHead;
                }
                else if (head == HeadSubType.Laser)
                {
                    theType = PartTypes.LaserHead;
                }
                else if (head == HeadSubType.Human)
                {
                    theType = PartTypes.Head;
                }
            }
            else if (type == LimbComponentType.Arm)
            {
                if (arm == ArmSubType.Hammer)
                {
                    theType = position == LimbPosition.Left ? PartTypes.HammerArmLeft : PartTypes.HammerArmRight;
                }
                else if (arm == ArmSubType.Hook)
                {
                    theType = position == LimbPosition.Left ? PartTypes.HookArmLeft : PartTypes.HookArmRight;
                }
                else if (arm == ArmSubType.Long)
                {
                    theType = position == LimbPosition.Left ? PartTypes.LongArmLeft : PartTypes.LongArmRight;
                }
                else if (arm == ArmSubType.Human)
                {
                    theType = position == LimbPosition.Left ? PartTypes.LeftArm : PartTypes.RightArm;
                }
            }
            else if (type == LimbComponentType.Leg)
            {
                if (leg == LegSubType.Gun)
                {
                    theType = position == LimbPosition.Left ? PartTypes.GunLegLeft : PartTypes.GunLegRight;
                }
                else if (leg == LegSubType.Rocket)
                {
                    theType = position == LimbPosition.Left ? PartTypes.RocketLegLeft : PartTypes.RocketLegRight;
                }
                else if (leg == LegSubType.Human)
                {
                    theType = position == LimbPosition.Left ? PartTypes.LeftLeg : PartTypes.RightLeg;
                }
            }
            else if (type == LimbComponentType.Torso)
            {
                if (torso == TorsoSubType.Human)
                {
                    theType = PartTypes.Torso;
                }
                else if (torso == TorsoSubType.Robot)
                {
                    theType = PartTypes.RobotTorso;
                }
            }

            LimbVisual visual = new LimbVisual(theType);

            this.blob.AddComponent(visual);
            PrepareDepth(visual);
        }
Пример #23
0
 public static int GetItemInventorySize(ItemType type) => PartTypes.Contains(type) ? 1 : 2;