コード例 #1
0
        public void Launch(Transform dummyPos)
        {
            Rigidbody.constraints = RigidbodyConstraints.None;
            transform.localScale  = Vector3.one * (Override_Scale / 1000f);

            Vector3 initVelocity = new Vector3(ProjectileInfo.ProjectileConfig.Velocity.x, ProjectileInfo.ProjectileConfig.Velocity.y, ProjectileInfo.ProjectileConfig.VelocityCurve.Evaluate(0) * Override_VelocityFactor);

            FlyRealtimeData = new ProjectileInfo.FlyRealtimeData
            {
                FlyDistance        = 0,
                FlyDuration        = 0,
                Scale              = transform.localScale,
                Position           = transform.position,
                Velocity_Local     = initVelocity,
                Velocity_Global    = transform.TransformVector(initVelocity),
                Accelerate         = ProjectileInfo.ProjectileConfig.Acceleration,
                HitCollider        = null,
                RemainCollideTimes = Override_CanReflect ? Override_ReflectTimes : 9999,
            };

            PlayFlashEffect(dummyPos);
            PlaySelfEffect();
            PoolRecycle(ParticleSystem.main.duration);
        }
コード例 #2
0
        private void ExecuteProjectileDamage(Ability parentAbility, ExecuteInfo executeInfo, ProjectileInfo.FlyRealtimeData flyRealTimeData)
        {
            if (parentAbility == executeInfo.Ability)
            {
                int finalDamage = Damage;
                switch (executeInfo.MechaComponentInfo.CurrentPowerUpgradeData)
                {
                case PowerUpgradeData_Gun pud_Gun:
                {
                    finalDamage += Mathf.FloorToInt(pud_Gun.DamageIncreasePercent / 100f * Damage);
                    break;
                }
                }

                switch (Target)
                {
                case SingleActionTarget singleTarget:
                {
                    switch (singleTarget.Target)
                    {
                    case ENUM_SingleTarget.ATTACKER:
                    {
                        break;
                    }

                    case ENUM_SingleTarget.CASTER:
                    {
                        if (flyRealTimeData.HitMechaComponentInfo != null)
                        {
                            if (flyRealTimeData.HitMechaComponentInfo == executeInfo.MechaComponentInfo && flyRealTimeData.HitMechaComponentInfo.CheckAlive())
                            {
                                Debug.Log($"{executeInfo.MechaComponentInfo.LogIdentityName} Dealt <color=\"#FF585F\">{finalDamage}</color> damage to <color=\"#FF74FF\">{singleTarget.Target.ToString()}</color> {flyRealTimeData.HitMechaComponentInfo.LogIdentityName}");
                                flyRealTimeData.HitMechaComponentInfo.Damage(executeInfo.MechaComponentInfo, finalDamage);
                            }
                        }

                        break;
                    }

                    case ENUM_SingleTarget.POINT:
                    {
                        break;
                    }

                    case ENUM_SingleTarget.TARGET:
                    {
                        break;
                    }

                    case ENUM_SingleTarget.UNIT:
                    {
                        if (flyRealTimeData.HitMechaComponentInfo != null && flyRealTimeData.HitMechaComponentInfo.CheckAlive())
                        {
                            bool canDamage = false;
                            switch (singleTarget.Team)
                            {
                            case ENUM_MultipleTargetTeam.UNIT_TARGET_TEAM_BOTH:
                            {
                                canDamage = true;
                                break;
                            }

                            case ENUM_MultipleTargetTeam.UNIT_TARGET_TEAM_ENEMY:
                            {
                                canDamage = flyRealTimeData.HitMechaComponentInfo.MechaInfo.IsOpponent(executeInfo.MechaInfo);
                                break;
                            }

                            case ENUM_MultipleTargetTeam.UNIT_TARGET_TEAM_FRIENDLY:
                            {
                                canDamage = flyRealTimeData.HitMechaComponentInfo.MechaInfo.IsFriend(executeInfo.MechaInfo);
                                break;
                            }

                            case ENUM_MultipleTargetTeam.UNIT_TARGET_TEAM_NONE:
                            {
                                canDamage = false;
                                break;
                            }
                            }

                            if (canDamage)
                            {
                                Debug.Log($"{executeInfo.MechaComponentInfo.LogIdentityName} Dealt <color=\"#FF585F\">{finalDamage}</color> damage to <color=\"#FF74FF\">{singleTarget.Target.ToString()}</color> {flyRealTimeData.HitMechaComponentInfo.LogIdentityName}");
                                flyRealTimeData.HitMechaComponentInfo.Damage(executeInfo.MechaComponentInfo, finalDamage);
                            }
                        }

                        break;
                    }
                    }

                    break;
                }

                case MultipleActionTarget multipleTarget:
                {
                    int finalRadius     = multipleTarget.Radius;
                    int finalMaxTargets = multipleTarget.MaxTargets;
                    switch (executeInfo.MechaComponentInfo.CurrentPowerUpgradeData)
                    {
                    case PowerUpgradeData_Gun pud_Gun:
                    {
                        finalRadius    += Mathf.FloorToInt(pud_Gun.DamageRangeIncreasePercent / 100f * multipleTarget.Radius);
                        finalMaxTargets = pud_Gun.DamageMaxTargetsOverride;
                        break;
                    }
                    }

                    switch (multipleTarget.Center)
                    {
                    case ENUM_MultipleTargetCenter.PROJECTILE:
                    {
                        List <MechaComponentInfo> hitMCIs = BattleManager.Instance.SearchRangeHandler(flyRealTimeData.Position, finalRadius, executeInfo.MechaInfo.MechaCamp, multipleTarget.Team, finalMaxTargets, multipleTarget.Random);
                        foreach (MechaComponentInfo mci in hitMCIs)
                        {
                            Debug.Log($"{executeInfo.MechaComponentInfo.LogIdentityName} Dealt <color=\"#FF585F\">{finalDamage}</color> damage to {mci.LogIdentityName}");
                            mci.Damage(executeInfo.MechaComponentInfo, finalDamage);
                        }

                        break;
                    }
                    }

                    break;
                }
                }
            }
        }