コード例 #1
0
        internal void SetupProjectile(Projectile projectile)
        {
            ModProjectile newProjectile = (ModProjectile)Activator.CreateInstance(GetType());

            newProjectile.projectile = projectile;
            projectile.modProjectile = newProjectile;
            newProjectile.mod        = mod;
            newProjectile.SetDefaults();
        }
コード例 #2
0
        public int ProjectileType(string name)
        {
            ModProjectile projectile = GetProjectile(name);

            if (projectile == null)
            {
                return(0);
            }
            return(projectile.projectile.type);
        }
コード例 #3
0
        internal void SetupProjectile(Projectile projectile)
        {
            ModProjectile newProjectile = (ModProjectile)(CloneNewInstances ? MemberwiseClone()
                                : Activator.CreateInstance(GetType()));

            newProjectile.projectile = projectile;
            projectile.modProjectile = newProjectile;
            newProjectile.mod        = mod;
            newProjectile.SetDefaults();
        }
コード例 #4
0
ファイル: ModInternals.cs プロジェクト: re4prr/tModLoader
        private void AutoloadProjectile(Type type)
        {
            ModProjectile projectile = (ModProjectile)Activator.CreateInstance(type);

            projectile.mod = this;
            string name = type.Name;

            if (projectile.Autoload(ref name))
            {
                AddProjectile(name, projectile);
            }
        }
コード例 #5
0
        public void AddProjectile(string name, ModProjectile projectile, string texture)
        {
            int id = ProjectileLoader.ReserveProjectileID();

            projectile.projectile.name       = name;
            projectile.Name                  = name;
            projectile.projectile.type       = id;
            projectiles[name]                = projectile;
            ProjectileLoader.projectiles[id] = projectile;
            projectile.texture               = texture;
            projectile.mod = this;
        }
コード例 #6
0
        private void AutoloadProjectile(Type type)
        {
            ModProjectile projectile = (ModProjectile)Activator.CreateInstance(type);

            projectile.mod = this;
            string name    = type.Name;
            string texture = (type.Namespace + "." + type.Name).Replace('.', '/');

            if (projectile.Autoload(ref name, ref texture))
            {
                AddProjectile(name, projectile, texture);
            }
        }
コード例 #7
0
        public static void UseGrapple(Player player, ref int type)
        {
            ModProjectile modProjectile = GetProjectile(type);

            if (modProjectile != null)
            {
                modProjectile.UseGrapple(player, ref type);
            }
            foreach (GlobalProjectile globalProjectile in globalProjectiles)
            {
                globalProjectile.UseGrapple(player, ref type);
            }
        }
コード例 #8
0
        public static bool?SingleGrappleHook(int type, Player player)
        {
            bool?         flag          = null;
            ModProjectile modProjectile = GetProjectile(type);

            if (modProjectile != null)
            {
                flag = modProjectile.SingleGrappleHook(player);
            }
            foreach (GlobalProjectile globalProjectile in globalProjectiles)
            {
                bool?singleHook = globalProjectile.SingleGrappleHook(type, player);
                if (singleHook.HasValue)
                {
                    flag = singleHook;
                }
            }
            return(flag);
        }
コード例 #9
0
        public static bool?CanUseGrapple(int type, Player player)
        {
            bool?         flag          = null;
            ModProjectile modProjectile = GetProjectile(type);

            if (modProjectile != null)
            {
                flag = modProjectile.CanUseGrapple(player);
            }
            foreach (GlobalProjectile globalProjectile in globalProjectiles)
            {
                bool?canGrapple = globalProjectile.CanUseGrapple(type, player);
                if (canGrapple.HasValue)
                {
                    flag = canGrapple;
                }
            }
            return(flag);
        }
コード例 #10
0
ファイル: ModProjectile.cs プロジェクト: Tea-Mod-Loader/Tea
        /// <summary>
        /// Create a new instance of this ModProjectile for a Projectile instance.
        /// Called at the end of Projectile.SetDefaults.
        /// If CloneNewInstances is true, just calls Clone()
        /// Otherwise calls the default constructor and copies fields
        /// </summary>
        public virtual ModProjectile NewInstance(Projectile projectileClone)
        {
            if (CloneNewInstances)
            {
                ModProjectile clone = Clone();
                clone.projectile = projectileClone;
                return(clone);
            }

            ModProjectile copy = (ModProjectile)Activator.CreateInstance(GetType());

            copy.projectile        = projectileClone;
            copy.Mod               = Mod;
            copy.aiType            = aiType;
            copy.cooldownSlot      = cooldownSlot;
            copy.drawOffsetX       = drawOffsetX;
            copy.drawOriginOffsetY = drawOriginOffsetY;
            copy.drawOriginOffsetX = drawOriginOffsetX;
            copy.drawHeldProjInFrontOfHeldItemAndArms = drawHeldProjInFrontOfHeldItemAndArms;
            return(copy);
        }
コード例 #11
0
ファイル: Mod.cs プロジェクト: popovn/tModLoader
 public void AddProjectile(string name, ModProjectile projectile, string texture)
 {
     int id = ProjectileLoader.ReserveProjectileID();
     projectile.projectile.name = name;
     projectile.Name = name;
     projectile.projectile.type = id;
     projectiles[name] = projectile;
     ProjectileLoader.projectiles[id] = projectile;
     projectile.texture = texture;
     projectile.mod = this;
 }