Ejemplo n.º 1
0
    public void CreateTrackingProjectile(BaseEntity source, BaseAbility ability, ProjectileItemParams param)
    {
        var projectile = new ProjectileItem(source, ability, param);

        projectile.ProjectileType = ProjectileType.Tracking;
        projectiles.Add(projectile);
    }
Ejemplo n.º 2
0
 public static WeaponItem GetWeaponItem(ProjectileItem projectileItem)
 {
     if (projectileItem == ProjectileItem.FLAKCANNON)
     {
         return(WeaponItem.NONE);
     }
     return(SharpHelper.StringToEnum <WeaponItem>(SharpHelper.EnumToString <ProjectileItem>(projectileItem)));
 }
Ejemplo n.º 3
0
 public void set_collision_as_equipped_projectile(GameObject new_projectile)
 {
     Debug.Log("setting collision as equipped projectile");
     has_projectile_item_grappled = true;
     sprender         = new_projectile.GetComponent <SpriteRenderer>();
     proj_sprite      = sprender.sprite;
     proj_script      = new_projectile.GetComponent <ProjectileItem>();
     sprender.enabled = false;
     new_projectile.GetComponent <Collider2D>().enabled = false;
     pistol_sprender.sprite = proj_sprite;
     equipped_projectile    = new_projectile;
 }
Ejemplo n.º 4
0
    /// <summary>
    /// 创建投掷物.
    /// </summary>
    public static ErrorCode createProjectiles(BattleUnit user, uint skillResID, uint projResID, Vector3 targetPosition)
    {
        ProjectileSettingsTableItem projSettings = DataManager.ProjectileSettingsTable[projResID] as ProjectileSettingsTableItem;

        for (uint i = 0; i < ProjectileSettingsTableItem.ProjectileCount; ++i)
        {
            ProjectileItem item = projSettings.items[i];

            if (item.bulletResID == uint.MaxValue)
            {
                break;
            }

            BulletTableItem bulletRes = DataManager.BulletTable[item.bulletResID] as BulletTableItem;

            // 枪口特效.
            if (item.bindpointEffect != uint.MaxValue)
            {
                SkillClientBehaviour.AddEffect2Object(user, item.bindpointEffect, item.initBindpoint);
            }

            ProjectileCreateParam param = new ProjectileCreateParam()
            {
                User                 = user,
                StartPosition        = user.GetBonePositionByName(item.initBindpoint),
                TargetPosition       = targetPosition,
                DistributionType     = item.distributionType,
                DistributionArgument = item.distributionArgument,
                BulletRes            = bulletRes,
                SkillResID           = skillResID
            };

            createProjectiles(param);
        }

        return(ErrorCode.Succeeded);
    }
Ejemplo n.º 5
0
 public static void Prefix(ref Projectile ___m_projectile, ProjectileItem __instance)
 {
     ___m_projectile = __instance.GetComponent <Projectile>();
 }
Ejemplo n.º 6
0
    private bool checkProjectileSettings()
    {
        DataType myName = DataType.DATA_PROJECTILE_SETTINGS;

        System.Type           T   = typeof(ProjectileSettingsTableItem);
        IDictionaryEnumerator itr = DataManager.ProjectileSettingsTable.GetEnumerator();

        while (itr.MoveNext())
        {
            ProjectileSettingsTableItem item = itr.Value as ProjectileSettingsTableItem;
            for (uint i = 0; i < ProjectileSettingsTableItem.ProjectileCount; ++i)
            {
                ProjectileItem subItem = item.items[i];

                uint bindpointEffect = subItem.bindpointEffect;
                uint bulletResID     = subItem.bulletResID;
                BulletDistributionType distributionType = subItem.distributionType;
                string distributionArgument             = subItem.distributionArgument;

                if (bulletResID == uint.MaxValue)
                {
                    continue;
                }

                if (bindpointEffect != uint.MaxValue &&
                    !checkLink(myName, item.resID, DataType.DATA_EFFECT, bindpointEffect))
                {
                    return(false);
                }

                if (!checkLink(myName, item.resID, DataType.DATA_SKILL_BULLET, bulletResID))
                {
                    return(false);
                }

                string[] args = distributionArgument.Split('|');
                switch (distributionType)
                {
                case BulletDistributionType.ByAngle:
                case BulletDistributionType.ByRandomOffset:
                    if (!checkParam(args.Length == 2, myName, item.resID, "分布参数"))
                    {
                        return(false);
                    }
                    break;

                case BulletDistributionType.ByData:
                    foreach (string str in args)
                    {
                        uint distribution = System.Convert.ToUInt32(str);
                        if (!checkLink(myName, item.resID, DataType.DATA_BULLET_DISTRIBUTION, distribution))
                        {
                            return(false);
                        }
                    }
                    break;

                default:
                    checkParam(false, myName, item.resID, "分布类型");
                    return(false);
                }
            }
        }
//      foreach (int key in DataManager.ProjectileSettingsTable.Keys)
//      {
//          ProjectileSettingsTableItem item = DataManager.ProjectileSettingsTable[key] as ProjectileSettingsTableItem;
//          for (uint i = 0; i < ProjectileSettingsTableItem.ProjectileCount; ++i)
//          {
//              ProjectileItem subItem = item.items[i];
//
//              uint bindpointEffect = subItem.bindpointEffect;
//              uint bulletResID = subItem.bulletResID;
//              BulletDistributionType distributionType = subItem.distributionType;
//              string distributionArgument = subItem.distributionArgument;
//
//              if (bulletResID == uint.MaxValue)
//                  continue;
//
//              if (bindpointEffect != uint.MaxValue
//                  && !checkLink(myName, key, DataType.DATA_EFFECT, bindpointEffect))
//                  return false;
//
//              if (!checkLink(myName, key, DataType.DATA_SKILL_BULLET, bulletResID))
//                  return false;
//
//              string[] args = distributionArgument.Split('|');
//              switch (distributionType)
//              {
//                  case BulletDistributionType.ByAngle:
//                  case BulletDistributionType.ByRandomOffset:
//                      if (!checkParam(args.Length == 2, myName, key, "分布参数"))
//                          return false;
//                      break;
//                  case BulletDistributionType.ByData:
//                      foreach (string str in args)
//                      {
//                          uint distribution = System.Convert.ToUInt32(str);
//                          if (!checkLink(myName, key, DataType.DATA_BULLET_DISTRIBUTION, distribution))
//                              return false;
//                      }
//                      break;
//                  default:
//                      checkParam(false, myName, key, "分布类型");
//                      return false;
//              }
//          }
//      }

        return(true);
    }