示例#1
0
        public LSProjectile PrepareProjectile(string projectileCode, Vector3d projOffset, Vector3d targetPos)
        {
            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.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;
            }

            return(currentProjectile);
        }
示例#2
0
        public LSProjectile FireProjectile(Vector3d projOffset, LSAgent target)
        {
            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.Homing:
                currentProjectile.InitializeHoming(target);
                break;

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

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

            case TargetingType.Free:
                //TODO
                throw new System.Exception("Not implemented yet.");
                //break;
            }
            if (onPrepareProjectile != null)
            {
                onPrepareProjectile(currentProjectile);
            }
            ProjectileManager.Fire(currentProjectile);
            return(currentProjectile);
        }
示例#3
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);
        }