コード例 #1
0
        public static int GetValue(Mobile m, ArmorAttribute attribute)
        {
            int value = 0;

            foreach (var item in m.GetEquippedItems())
            {
                if (item is IArmor)
                {
                    ArmorAttributes attrs = ((IArmor)item).ArmorAttributes;

                    if (attrs != null)
                    {
                        value += attrs[attribute];
                    }
                }
                else if (item is ICloth)
                {
                    ArmorAttributes attrs = ((ICloth)item).ClothingAttributes;

                    if (attrs != null)
                    {
                        value += attrs[attribute];
                    }
                }
            }

            return(value);
        }
コード例 #2
0
ファイル: IfBreakdown.cs プロジェクト: X0xxxxx/Tank
    void OnCollisionEnter(Collision collision)
    {
        var name = collision.collider.name;

        Debug.Log("Name is " + name);

        /*撞到装甲的话,计算入射角*/
        if (collision.transform.GetComponent <ArmorAttribute>() != null)
        {
            Vector3 ShellDirection = this.GetComponent <GetDirection>().Direction;
            Vector3 ArmorDirection = collision.collider.GetComponent <GetDirection>().Direction;
            float   fenzi, fenmu;
            fenzi = (ShellDirection.x * ArmorDirection.x) + (ShellDirection.y * ArmorDirection.y) + (ShellDirection.z * ArmorDirection.z);
            fenmu = (Mathf.Sqrt(Mathf.Pow(ShellDirection.x, 2) + Mathf.Pow(ShellDirection.y, 2) + Mathf.Pow(ShellDirection.z, 2))) *
                    (Mathf.Sqrt(Mathf.Pow(ArmorDirection.x, 2) + Mathf.Pow(ArmorDirection.y, 2) + Mathf.Pow(ArmorDirection.z, 2)));
            float AOIcos = -(fenzi / fenmu);

            ArmorAttribute ArmorThickness = collision.collider.GetComponent <ArmorAttribute>();
            float          RealThickness  = ArmorThickness.thickness / Mathf.Abs(AOIcos);

            MesofAP chuangshenduqu = this.GetComponent <MesofAP>();

            float Realchuangshen = chuangshenduqu.chuangshen;

            if (Realchuangshen >= RealThickness)
            {
                //扣血,使用getcomponment使所撞车辆扣血
                //Debug.Log("Destroy");
                collision.collider.transform.GetComponentInParent <PartAttribute>().aiHealthy -= 300;
                //Debug.Log("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT");
            }
            else
            {
                Debug.Log("Nothing happen");
            }
            Debug.Log("等效" + RealThickness);
            Destroy(this.gameObject);
        }
        Destroy(this.gameObject);
    }
コード例 #3
0
    void OnCollisionEnter(Collision collision)
    {
        var name = collision.collider.name;

        Debug.Log("Name is " + name);
        if (collision.transform.GetComponent <ArmorAttribute>() != null)
        {
            /*计算入射角*/
            Vector3 ShellDirection = this.GetComponent <GetDirection>().Direction;
            Vector3 ArmorDirection = collision.collider.GetComponent <GetDirection>().Direction;
            float   fenzi, fenmu;
            fenzi = (ShellDirection.x * ArmorDirection.x) + (ShellDirection.y * ArmorDirection.y) + (ShellDirection.z * ArmorDirection.z);
            fenmu = (Mathf.Sqrt(Mathf.Pow(ShellDirection.x, 2) + Mathf.Pow(ShellDirection.y, 2) + Mathf.Pow(ShellDirection.z, 2))) *
                    (Mathf.Sqrt(Mathf.Pow(ArmorDirection.x, 2) + Mathf.Pow(ArmorDirection.y, 2) + Mathf.Pow(ArmorDirection.z, 2)));
            float AOIcos = -(fenzi / fenmu);

            ArmorAttribute ArmorThickness = collision.collider.GetComponent <ArmorAttribute>();
            float          RealThickness  = ArmorThickness.thickness / Mathf.Abs(AOIcos);

            MesofHE chuangshenduqu = this.GetComponent <MesofHE>();

            float Realchuangshen = chuangshenduqu.chuangshen;

            if (Realchuangshen >= RealThickness)
            {
                //Debug.Log("HE击穿");
                collision.collider.transform.GetComponentInParent <PartAttribute>().aiHealthy -= 500;
            }
            else
            {
                //Debug.Log("计算伤害");//纸面伤害/2 - 击中处装甲值
                collision.collider.transform.GetComponentInParent <PartAttribute>().aiHealthy -= 250 - ArmorThickness.thickness;
            }

            Debug.Log("等效" + RealThickness);
        }
        Destroy(this.gameObject);
    }
コード例 #4
0
ファイル: ArmorSkill.cs プロジェクト: reaganq/mixabots
 public void InitializeAttributesStats(ArmorAttribute[] attributes, SkillEffect[] effects)
 {
     //characterTransform = Player.Instance.avatarObject.transform;
     skillEffects = effects;
     armorAttributes = attributes;
 }
コード例 #5
0
ファイル: BaseRunicTool.cs プロジェクト: Ravenwolfe/xrunuo
 private static void ApplyAttribute( ArmorAttributes attrs, int min, int max, ArmorAttribute attr, int low, int high, int scale )
 {
     attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale;
 }
コード例 #6
0
ファイル: BaseRunicTool.cs プロジェクト: Ravenwolfe/xrunuo
 private static void ApplyAttribute( ArmorAttributes attrs, int min, int max, ArmorAttribute attr, int low, int high )
 {
     attrs[attr] = Scale( min, max, low, high );
 }
コード例 #7
0
ファイル: BaseRunicTool.cs プロジェクト: nogu3ira/xrunuo
 private static void ApplyAttribute(ArmorAttributes attrs, int min, int max, ArmorAttribute attr, int low, int high, int scale)
 {
     attrs[attr] = Scale(min, max, low / scale, high / scale) * scale;
 }
コード例 #8
0
ファイル: BaseRunicTool.cs プロジェクト: nogu3ira/xrunuo
 private static void ApplyAttribute(ArmorAttributes attrs, int min, int max, ArmorAttribute attr, int low, int high)
 {
     attrs[attr] = Scale(min, max, low, high);
 }
コード例 #9
0
 public OtherArmorAttrInfo(ArmorAttribute attr, int min, int max)
 {
     m_Attribute    = attr;
     m_MinIntensity = min;
     m_MaxIntensity = max;
 }
コード例 #10
0
 public int this[ArmorAttribute attribute] {
     get { return(GetValue((int)attribute)); } set { SetValue((int)attribute, value); }
 }