示例#1
0
        public LSProjectile PrepareProjectile(string projectileCode, Vector3d projOffset, LSAgent target)
        {
            LastFire = this;
            LSProjectile currentProjectile = ProjectileManager.Create(
                projectileCode,
                this.Agent,
                projOffset,
                this.TargetAllegiance,
                (other) =>
            {
                Health healther = other.GetAbility <Health>();
                return(healther.IsNotNull() && healther.HealthAmount > 0);
            },
                CachedOnHit);

            switch (currentProjectile.TargetingBehavior)
            {
            case TargetingType.Homing:
                currentProjectile.InitializeHoming(target);
                break;

            case TargetingType.Timed:
                currentProjectile.InitializeTimed(target);
                break;

            case TargetingType.Positional:
                currentProjectile.InitializePositional(target.Body.Position.ToVector3d(target.Body.HeightPos));
                break;

            case TargetingType.Directional:
                //TODO
                throw new System.Exception("Not implemented yet.");
                //break;
            }
            OnPrepareProjectile(currentProjectile);
            return(currentProjectile);
        }
示例#2
0
        protected virtual void OnFire()
        {
            long appliedDamage = Damage;

            LSProjectile projectile = ProjectileManager.Create(
                ProjCode,
                this.Agent,
                this.ProjectileOffset,
                this.TargetAllegiance,
                (other) =>
            {
                Health healther = other.GetAbility <Health>();
                return(healther.IsNotNull() && healther.HealthAmount > 0);
            },
                CachedOnHit);

            switch (projectile.TargetingBehavior)
            {
            case TargetingType.Homing:
                projectile.InitializeHoming(this.Target);
                break;

            case TargetingType.Timed:
                projectile.InitializeTimed();
                break;

            case TargetingType.Positional:
                projectile.InitializePositional(Target.Body.Position.ToVector3d(Target.Body.HeightPos));
                break;

            case TargetingType.Free:
                //TODO
                throw new System.Exception("Not implemented yet.");
                break;
            }
            ProjectileManager.Fire(projectile);
        }
        private void Fire()
        {
            if (this.ShootType == ShootType.Single)
            {
                this.IsFiring = false;
            }
            this.FireCount = FirePeriod;

            FPSTurn      turn       = Agent.GetAbility <FPSTurn>();
            int          bodyID     = Agent.Body.ID;
            LSProjectile projectile = ProjectileManager.Create(this.ProjCode, Agent, ProjectileStartPosition, AllegianceType.All, (agent) => true, (agent) => agent.Body.TestFlash());

            projectile.InitializeFree(turn.Forward, (body) => body.ID != bodyID);
            ProjectileManager.Fire(projectile);

            if (this.PassedFrames > 0)
            {
                Vector3d delta = projectile.Velocity;
                delta.Mul((int)PassedFrames);
                projectile.RaycastMove(delta);

                PassedFrames = 0;
            }
        }
示例#4
0
        public LSProjectile FireProjectile(string projCode, Vector3d projOffset, Vector3d targetPos)
        {
            LSProjectile currentProjectile = ProjectileManager.Create(
                projCode,
                this.Agent,
                projOffset,
                this.TargetAllegiance,
                (other) =>
            {
                Health healther = other.GetAbility <Health>();
                return(healther.IsNotNull() && healther.HealthAmount > 0);
            },
                CachedOnHit);

            switch (currentProjectile.TargetingBehavior)
            {
            case TargetingType.Timed:
                currentProjectile.InitializeTimed(Agent.Body.Forward);
                break;

            case TargetingType.Positional:
                currentProjectile.InitializePositional(targetPos);
                break;

            case TargetingType.Free:
                //TODO
                throw new System.Exception("Not implemented yet.");
                //break;
            }
            if (onPrepareProjectile != null)
            {
                onPrepareProjectile(currentProjectile);
            }
            ProjectileManager.Fire(currentProjectile);
            return(currentProjectile);
        }