Beispiel #1
0
        public override Dictionary <PrefabProfile, GameObject> Cast(IAbilityCaster source, Interactable target, Interactable originalTarget, AbilityEffectContext abilityEffectContext)
        {
            //Debug.Log(DisplayName + ".ProjectileEffect.Cast(" + source.AbilityManager.Name + ", " + (target == null ? "null" : target.name) + ")");
            Dictionary <PrefabProfile, GameObject> returnObjects = base.Cast(source, target, originalTarget, abilityEffectContext);

            if (returnObjects != null)
            {
                foreach (GameObject go in returnObjects.Values)
                {
                    //Debug.Log(MyName + ".ProjectileEffect.Cast(): found gameobject: " + go.name);
                    go.transform.parent = PlayerManager.MyInstance.EffectPrefabParent.transform;
                    ProjectileScript projectileScript = go.GetComponentInChildren <ProjectileScript>();
                    if (projectileScript != null)
                    {
                        //Debug.Log(MyName + ".ProjectileEffect.Cast(): found gameobject: " + go.name + " and it has projectile script");
                        abilityEffectContext = ApplyInputMultiplier(abilityEffectContext);
                        projectileScript.Initialize(projectileSpeed, source, target, new Vector3(0, 1, 0), abilityEffectContext);
                        if (flightAudioProfiles != null && flightAudioProfiles.Count > 0)
                        {
                            projectileScript.PlayFlightAudio(flightAudioProfiles, randomFlightAudioProfiles);
                        }
                        projectileScript.OnCollission += HandleCollission;
                    }
                }
            }
            return(returnObjects);
        }
        public override void Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(MyName + ".ProjectileAttackEffect.Cast(" + source.name + ", " + target.name + ")");
            base.Cast(source, target, originalTarget, abilityEffectInput);
            ProjectileScript projectileScript = abilityEffectObject.GetComponent <ProjectileScript>();

            if (projectileScript != null)
            {
                abilityEffectInput = ApplyInputMultiplier(abilityEffectInput);
                projectileScript.Initialize(projectileSpeed, source, target, new Vector3(0, 1, 0), abilityEffectInput);
                projectileScript.OnCollission += HandleCollission;
            }
        }
        public override Dictionary <PrefabProfile, GameObject> Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log(MyName + ".ProjectileAttackEffect.Cast(" + source.name + ", " + target.name + ")");
            Dictionary <PrefabProfile, GameObject> returnObjects = base.Cast(source, target, originalTarget, abilityEffectInput);

            if (returnObjects != null)
            {
                foreach (GameObject go in returnObjects.Values)
                {
                    go.transform.parent = PlayerManager.MyInstance.MyEffectPrefabParent.transform;
                    ProjectileScript projectileScript = go.GetComponent <ProjectileScript>();
                    if (projectileScript != null)
                    {
                        abilityEffectInput = ApplyInputMultiplier(abilityEffectInput);
                        projectileScript.Initialize(projectileSpeed, source, target, new Vector3(0, 1, 0), abilityEffectInput);
                        projectileScript.OnCollission += HandleCollission;
                    }
                }
            }
            return(returnObjects);
        }