public void FireCall()
    {
        if((this!=null) && (Time.time > ((1f/rateOfFire)+lastFireTime)))
        {
            if(readyObject!=null)
            {
                readyObject.SetActive(false);
            }
            lastFireTime = Time.time;

            if(firingSound!=null)
            {
                SoundManager.singleton.playModulatedSound(firingSound, .5f);
            }

            //Debug.Log ("Direct Fire");
            // Show particle effect
            targetObject = Instantiate(targetPrefab, Vector3.zero, Quaternion.identity) as GameObject;
            targetObject.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0f));
            particleObject = Instantiate(particlePrefab, transform.position, Quaternion.identity) as GameObject;
            particleScript = particleObject.GetComponent<EffectSettings>();
            particleScript.Target = targetObject;
            particleScript.MoveDistance = Vector3.Distance(targetObject.transform.position, transform.position)-0.5f;
            particleScript.MoveSpeed = 4f;

        }
    }
 void GetEffectSettingsComponent(Transform tr)
 {
     var parent = tr.parent;
     if (parent!=null) {
       effectSettings = parent.GetComponentInChildren<EffectSettings>();
       if (effectSettings == null)
       GetEffectSettingsComponent(parent.transform);
     }
 }
Beispiel #3
0
 private void InstanceEffectWithoutObjectPool()
 {
   currentGo = Instantiate(Prefabs[current], GetInstancePosition(GuiStats[current]), Prefabs[current].transform.rotation) as GameObject;
   effectSettings = currentGo.GetComponent<EffectSettings>();
   effectSettings.Target = GetTargetObject(GuiStats[current]);
   if (isHomingMove) effectSettings.IsHomingMove = isHomingMove;
   prefabSpeed = effectSettings.MoveSpeed;
   effectSettings.EffectDeactivated += effectSettings_EffectDeactivated;
   currentGo.transform.parent = transform;
 }
Beispiel #4
0
 private void InstanceEffect(Vector3 pos)
 {
   currentGo = Instantiate(Prefabs[current], pos, Prefabs[current].transform.rotation) as GameObject;
   effectSettings = currentGo.GetComponent<EffectSettings>();
   effectSettings.Target = GetTargetObject(GuiStats[current]);
   if (isHomingMove) effectSettings.IsHomingMove = isHomingMove;
   prefabSpeed = effectSettings.MoveSpeed;
   effectSettings.EffectDeactivated+=effectSettings_EffectDeactivated;
   currentGo.transform.parent = transform;
   //effectSettings.CollisionEnter += (n, e) => { if(e.Hit.transform!=null) Debug.Log(e.Hit.transform.name); };
 }
Beispiel #5
0
        public override void SetPotionProperties()
        {
            // Magnitude 5-5 + 4-4 per 1 levels
            EffectSettings staminaSettings = SetEffectMagnitude(DefaultEffectSettings(), 5, 5, 4, 4, 1);
            PotionRecipe   stamina         = new PotionRecipe(
                TextManager.Instance.GetText(textDatabase, "stamina"),
                25,
                staminaSettings,
                (int)Items.MiscellaneousIngredients1.Pure_water,
                (int)Items.PlantIngredients2.Aloe,
                (int)Items.PlantIngredients2.Ginkgo_leaves);

            // Assign recipe
            AssignPotionRecipes(stamina);
        }
        public override void SetPotionProperties()
        {
            EffectSettings cureSettings = SetEffectChance(DefaultEffectSettings(), 5, 19, 1);
            PotionRecipe   curePoison   = new PotionRecipe(
                TextManager.Instance.GetText(textDatabase, "curePoison"),
                200,
                cureSettings,
                (int)Items.MiscellaneousIngredients1.Ichor,
                (int)Items.CreatureIngredients2.Giant_scorpion_stinger,
                (int)Items.MiscellaneousIngredients1.Small_tooth,
                (int)Items.MiscellaneousIngredients2.Pearl);

            curePoison.TextureRecord = 35;
            AssignPotionRecipes(curePoison);
        }
Beispiel #7
0
        public void MonsterHasStunnedEffectUnitTest()
        {
            Monster        monster        = new Monster(5, MonsterType.Skeleton);
            EffectSettings effectSettings = new EffectSettings {
                EffectHolder = monster,
                Name         = "stunned test",
                MaxRound     = 3
            };
            IEffect stunnedEffect = new StunnedEffect(effectSettings);

            monster.Effects.Add(stunnedEffect);

            Assert.AreEqual(1, monster.Effects.Count);
            Assert.AreEqual(true, monster.Effects[0] is StunnedEffect);
        }
        public override void SetPotionProperties()
        {
            EffectSettings cureSettings = SetEffectChance(DefaultEffectSettings(), 5, 19, 1);
            PotionRecipe   freeAction   = new PotionRecipe(
                TextManager.Instance.GetText(textDatabase, "freeAction"),
                125,
                cureSettings,
                (int)Items.MiscellaneousIngredients1.Ichor,
                (int)Items.CreatureIngredients1.Spider_venom,
                (int)Items.PlantIngredients1.Twigs,
                (int)Items.PlantIngredients2.Bamboo);

            freeAction.TextureRecord = 14;
            AssignPotionRecipes(freeAction);
        }
    private void GetEffectSettingsComponent(Transform tr)
    {
        Transform parent = tr.get_parent();

        if (!Object.op_Inequality((Object)parent, (Object)null))
        {
            return;
        }
        this.effectSettings = (EffectSettings)((Component)parent).GetComponentInChildren <EffectSettings>();
        if (!Object.op_Equality((Object)this.effectSettings, (Object)null))
        {
            return;
        }
        this.GetEffectSettingsComponent(((Component)parent).get_transform());
    }
        public override void OnEnter()
        {
            if (effectOwner == null)
            {
                Finish();
            }
            var go = Fsm.GetOwnerDefaultTarget(effectOwner);

            script = go.gameObject.GetComponent <EffectSettings>();

            if (everyFrame.Value == false)
            {
                DoFxSettings();
                Finish();
            }
        }
Beispiel #11
0
        public void CreateStunnedEffectUnitTest()
        {
            Monster        monster        = new Monster(5, MonsterType.Skeleton);
            EffectSettings effectSettings = new EffectSettings {
                EffectHolder = monster,
                Name         = "stunned test",
                MaxRound     = 3
            };
            IEffect stunnedEffect = new StunnedEffect(effectSettings);

            Assert.AreEqual(1, stunnedEffect.TickDuration);
            Assert.AreEqual(true, stunnedEffect.IsHarmful);
            Assert.AreEqual(effectSettings.Name, stunnedEffect.Name);
            Assert.AreEqual(1, stunnedEffect.CurrentRound);
            Assert.AreEqual(effectSettings.MaxRound, stunnedEffect.MaxRound);
        }
        public override void SetPotionProperties()
        {
            EffectSettings regenerateSettings = SetEffectMagnitude(DefaultEffectSettings(), 6, 6, 7, 7, 1);
            PotionRecipe   regenerate         = new PotionRecipe(
                "Regeneration",
                155,
                DefaultEffectSettings(),
                (int)MiscellaneousIngredients1.Rain_water,
                (int)CreatureIngredients1.Troll_blood,
                (int)CreatureIngredients2.Small_scorpion_stinger);

            // Assign recipes
            AssignPotionRecipes(regenerate);

            regenerate.TextureRecord = 16;
        }
        public override void SetPotionProperties()
        {
            EffectSettings jumpingSettings = SetEffectMagnitude(DefaultEffectSettings(), 7, 7, 7, 7, 1);
            PotionRecipe   jumping         = new PotionRecipe(
                "Jumping",
                156,
                DefaultEffectSettings(),
                (int)PlantIngredients2.Bamboo,
                (int)PlantIngredients1.Red_berries,
                (int)MiscellaneousIngredients1.Elixir_vitae);

            // Assign recipes
            AssignPotionRecipes(jumping);

            jumping.TextureRecord = 35;
        }
Beispiel #14
0
        public override void SetPotionProperties()
        {
            // Magnitude 1-1 + 14-14 per 1 levels
            EffectSettings orcStrengthSettings = SetEffectMagnitude(DefaultEffectSettings(), 1, 1, 14, 14, 1);
            PotionRecipe   orcStrength         = new PotionRecipe(
                TextManager.Instance.GetLocalizedText("orcStrength"),
                50,
                orcStrengthSettings,
                (int)Items.CreatureIngredients1.Orcs_blood,
                (int)Items.MetalIngredients.Iron,
                (int)Items.MiscellaneousIngredients1.Pure_water);

            // Assign recipe
            orcStrength.TextureRecord = 13;
            AssignPotionRecipes(orcStrength);
        }
Beispiel #15
0
        public async void ResetSettings()
        {
            var resetConfirm = await
                               DialogService.ShowQuestionMessageBox("Reset effect settings",
                                                                    "Are you sure you wish to reset this effect's settings? \nAny changes you made will be lost.");

            if (!resetConfirm.Value)
            {
                return;
            }

            EffectSettings.ToDefault();
            NotifyOfPropertyChange(() => EffectSettings);

            SaveSettings();
        }
Beispiel #16
0
        public override void SetPotionProperties()
        {
            EffectSettings climbingSettings = SetEffectMagnitude(DefaultEffectSettings(), 8, 8, 7, 7, 1);
            PotionRecipe   climbing         = new PotionRecipe(
                "Acrobat",
                158,
                DefaultEffectSettings(),
                (int)PlantIngredients2.Green_berries,
                (int)CreatureIngredients1.Gorgon_snake,
                (int)MetalIngredients.Sulphur);

            // Assign recipes
            AssignPotionRecipes(climbing);

            climbing.TextureRecord = 14;
        }
Beispiel #17
0
    // Token: 0x0600434B RID: 17227 RVA: 0x00162128 File Offset: 0x00160528
    private void Start()
    {
        this.oldAmbientColor   = RenderSettings.ambientLight;
        this.oldLightIntensity = this.DirLight.intensity;
        this.anim = this.Target.GetComponent <Animator>();
        this.guiStyleHeader.fontSize         = 14;
        this.guiStyleHeader.normal.textColor = new Color(1f, 1f, 1f);
        EffectSettings component = this.Prefabs[this.current].GetComponent <EffectSettings>();

        if (component != null)
        {
            this.prefabSpeed = component.MoveSpeed;
        }
        this.current = this.CurrentPrefabNomber;
        this.InstanceCurrent(this.GuiStats[this.CurrentPrefabNomber]);
    }
        public override void SetPotionProperties()
        {
            EffectSettings comprehendlanguagesSettings = SetEffectMagnitude(DefaultEffectSettings(), 8, 8, 7, 7, 1);
            PotionRecipe   comprehendlanguages         = new PotionRecipe(
                "Ambassador",
                154,
                DefaultEffectSettings(),
                (int)MiscellaneousIngredients1.Pure_water,
                (int)PlantIngredients1.Red_rose,
                (int)CreatureIngredients1.Ghouls_tongue);

            // Assign recipes
            AssignPotionRecipes(comprehendlanguages);

            comprehendlanguages.TextureRecord = 34;
        }
        public override void SetPotionProperties()
        {
            EffectSettings shieldSettings = SetEffectMagnitude(DefaultEffectSettings(), 5, 5, 8, 8, 1);
            PotionRecipe   shield         = new PotionRecipe(
                "Shielding",
                163,
                DefaultEffectSettings(),
                (int)MiscellaneousIngredients1.Medium_tooth,
                (int)CreatureIngredients2.Dragons_scales,
                (int)CreatureIngredients2.Giant_scorpion_stinger,
                (int)MetalIngredients.Platinum);

            // Assign recipes
            AssignPotionRecipes(shield);

            shield.TextureRecord = 12;
        }
        void SetSpinners(EffectSettings settings)
        {
            if (!IsSetup)
                return;

            durationBaseSpinner.Value = settings.DurationBase;
            durationPlusSpinner.Value = settings.DurationPlus;
            durationPerLevelSpinner.Value = settings.DurationPerLevel;
            chanceBaseSpinner.Value = settings.ChanceBase;
            chancePlusSpinner.Value = settings.ChancePlus;
            chancePerLevelSpinner.Value = settings.ChancePerLevel;
            magnitudeBaseMinSpinner.Value = settings.MagnitudeBaseMin;
            magnitudeBaseMaxSpinner.Value = settings.MagnitudeBaseMax;
            magnitudePlusMinSpinner.Value = settings.MagnitudePlusMin;
            magnitudePlusMaxSpinner.Value = settings.MagnitudePlusMax;
            magnitudePerLevelSpinner.Value = settings.MagnitudePerLevel;
        }
Beispiel #21
0
        public override void SetPotionProperties()
        {
            EffectSettings createitemSettings = SetEffectMagnitude(DefaultEffectSettings(), 6, 6, 7, 7, 1);
            PotionRecipe   createitem         = new PotionRecipe(
                "Forge",
                161,
                DefaultEffectSettings(),
                (int)CreatureIngredients1.Giant_blood,
                (int)MiscellaneousIngredients1.Ichor,
                (int)PlantIngredients2.Cactus,
                (int)MetalIngredients.Lead);

            // Assign recipes
            AssignPotionRecipes(createitem);

            createitem.TextureRecord = 34;
        }
        public override void SetPotionProperties()
        {
            EffectSettings spellresistanceSettings = SetEffectMagnitude(DefaultEffectSettings(), 7, 7, 7, 7, 1);
            PotionRecipe   spellresistance         = new PotionRecipe(
                "Arcane Protection",
                160,
                DefaultEffectSettings(),
                (int)CreatureIngredients1.Lich_dust,
                (int)CreatureIngredients2.Gryphon_Feather,
                (int)PlantIngredients1.Root_bulb,
                (int)MetalIngredients.Silver);

            // Assign recipes
            AssignPotionRecipes(spellresistance);

            spellresistance.TextureRecord = 12;
        }
Beispiel #23
0
        private void ProfileUpdater(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName != "SelectedProfile" && IsActive)
            {
                return;
            }
            EffectModel.Profile         = ProfileEditor.SelectedProfile;
            ProfilePreviewModel.Profile = ProfileEditor.SelectedProfile;

            if (e.PropertyName != "SelectedProfile" || !ProfileEditor.ProfileViewModel.Activated ||
                ProfileEditor.ProfileViewModel.SelectedProfile == null)
            {
                return;
            }
            ((WindowsProfileSettings)EffectSettings).LastProfile = ProfileEditor.ProfileViewModel.SelectedProfile.Name;
            EffectSettings.Save();
        }
Beispiel #24
0
        public override void SetPotionProperties()
        {
            // Magnitude 5-5 + 4-4 per 1 levels
            EffectSettings restorePowerSettings = SetEffectMagnitude(DefaultEffectSettings(), 5, 5, 4, 4, 1);
            PotionRecipe   restorePower         = new PotionRecipe(
                "restorePower",
                75,
                restorePowerSettings,
                (int)Items.MiscellaneousIngredients1.Nectar,
                (int)Items.MetalIngredients.Silver,
                (int)Items.CreatureIngredients1.Werewolfs_blood,
                (int)Items.CreatureIngredients1.Saints_hair);

            // Assign recipe
            restorePower.TextureRecord = 12;
            AssignPotionRecipes(restorePower);
        }
Beispiel #25
0
        public override void SetPotionProperties()
        {
            EffectSettings spellabsorptionSettings = SetEffectMagnitude(DefaultEffectSettings(), 5, 5, 8, 8, 1);
            PotionRecipe   spellabsorption         = new PotionRecipe(
                "Magic Absorption",
                162,
                DefaultEffectSettings(),
                (int)CreatureIngredients3.Unicorn_horn,
                (int)CreatureIngredients1.Werewolfs_blood,
                (int)MetalIngredients.Brass,
                (int)CreatureIngredients1.Daedra_heart,
                (int)PlantIngredients2.Fig);

            // Assign recipes
            AssignPotionRecipes(spellabsorption);

            spellabsorption.TextureRecord = 35;
        }
Beispiel #26
0
        public override void SetPotionProperties()
        {
            // Duration 180 + 0 per 1 levels
            EffectSettings lightSpriteSettings = SetEffectDuration(DefaultEffectSettings(), 180, 0, 1);
            PotionRecipe   lightSprite         = new PotionRecipe(
                "Light Sprite",
                15,
                0,
                25,
                lightSpriteSettings,
                (int)Items.SolventIngredients.Nectar,
                (int)Items.FlowerPlantIngredients.Golden_poppy,
                (int)Items.MiscPlantIngredients.Twigs,
                (int)Items.MetalIngredients.Sulphur);

            lightSprite.TextureRecord = 34;
            AssignPotionRecipes(lightSprite);
        }
Beispiel #27
0
        public override void SetPotionProperties()
        {
            // Duration 10 + 0 per 1 levels
            EffectSettings safeLandingSettings = SetEffectDuration(DefaultEffectSettings(), 10, 0, 1);
            PotionRecipe   safeLanding         = new PotionRecipe(
                "Safe Landing",
                16,
                0,
                25,
                safeLandingSettings,
                (int)Items.SolventIngredients.Rain_water,
                (int)Items.MiscPlantIngredients.Green_leaves,
                (int)Items.MiscPlantIngredients.Palm,
                (int)Items.CreatureIngredients.Harpy_Feather);

            safeLanding.TextureRecord = 35;
            AssignPotionRecipes(safeLanding);
        }
        public override void SetPotionProperties()
        {
            EffectSettings regeneratespellpointsSettings = SetEffectMagnitude(DefaultEffectSettings(), 10, 10, 6, 6, 1);
            PotionRecipe   regeneratespellpoints         = new PotionRecipe(
                "Magicka Regeneration",
                165,
                regeneratespellpointsSettings,
                (int)MiscellaneousIngredients1.Rain_water,
                (int)PlantIngredients2.Yellow_flowers,
                (int)CreatureIngredients1.Spider_venom,
                (int)PlantIngredients1.Pine_branch,
                (int)CreatureIngredients2.Small_scorpion_stinger);

            // Assign recipes
            AssignPotionRecipes(regeneratespellpoints);

            regeneratespellpoints.TextureRecord = 12;
        }
Beispiel #29
0
        public void MonsterStunnedEffectDoesNotExpireWhenCurrentRoundEqualsMaxRoundUnitTest()
        {
            Monster        monster        = new Monster(5, MonsterType.Skeleton);
            EffectSettings effectSettings = new EffectSettings {
                EffectHolder = monster,
                Name         = "stunned test",
                MaxRound     = 3
            };
            IEffect stunnedEffect = new StunnedEffect(effectSettings);

            for (int i = 0; i < effectSettings.MaxRound - 1; i++)
            {
                stunnedEffect.ProcessRound();
            }

            Assert.AreEqual(3, stunnedEffect.CurrentRound);
            Assert.AreEqual(false, stunnedEffect.IsEffectExpired);
        }
Beispiel #30
0
        public void MonsterStunnedEffectExpiresWhenCurrentRoundGreaterThanMaxRoundUnitTest()
        {
            Monster        monster        = new Monster(5, MonsterType.Skeleton);
            EffectSettings effectSettings = new EffectSettings {
                EffectHolder = monster,
                Name         = "stunned test",
                MaxRound     = 3
            };
            IEffect stunnedEffect = new StunnedEffect(effectSettings);

            for (int i = 0; i < stunnedEffect.MaxRound; i++)
            {
                stunnedEffect.ProcessRound();
            }

            Assert.AreEqual(4, stunnedEffect.CurrentRound);
            Assert.AreEqual(true, stunnedEffect.IsEffectExpired);
        }
Beispiel #31
0
    public static EffectManager Setup(EffectSettings settings)
    {
        instance = new GameObject("EffectManager").AddComponent <EffectManager>();

        //instance.settings = settings;

        instance.idToEffect     = new Dictionary <int, EffectInstance>();
        instance.playingEffects = new List <EffectInstance>();

        instance.idCounter = 0;

        instance.prefabToEffectPool = new Dictionary <GameObject, DynamicPool <EffectInstance> >();

        instance.noPrefabDummy           = new GameObject("NoPrefabEffectDummy");
        instance.noPrefabDummy.hideFlags = HideFlags.HideAndDontSave;

        return(instance);
    }
        public override void SetPotionProperties()
        {
            // Duration 20 + 0 per 1 levels
            EffectSettings gillsSettings = SetEffectDuration(DefaultEffectSettings(), 20, 0, 1);
            PotionRecipe   gills         = new PotionRecipe(
                "Gills",
                27,
                0,
                30,
                gillsSettings,
                (int)Items.SolventIngredients.Rain_water,
                (int)Items.MiscPlantIngredients.Palm,
                (int)Items.AnimalPartIngredients.Pearl,
                (int)Items.AnimalPartIngredients.Small_tooth);

            gills.TextureRecord = 32;
            AssignPotionRecipes(gills);
        }
Beispiel #33
0
        public void CastFrostOffense(Monster monster, Player player, int index)
        {
            monster.EnergyPoints -= monster.Spellbook[index].EnergyCost;

            string attackString = $"The {monster.Name} conjures up a frostbolt and launches it at you!";

            OutputHelper.Display.StoreUserOutput(
                Settings.FormatAttackSuccessText(),
                Settings.FormatDefaultBackground(),
                attackString);

            int frostSpellDamage = MonsterHelper.CalculateSpellDamage(player, monster, index);

            frostSpellDamage = CombatHelper.GetMonsterAttackDamageUpdatedFromPlayerEffects(player, monster, frostSpellDamage);

            if (frostSpellDamage == 0)
            {
                return;
            }

            player.HitPoints -= frostSpellDamage;

            string attackSuccessString = $"The {monster.Name} hits you for {frostSpellDamage} frost damage.";

            OutputHelper.Display.StoreUserOutput(
                Settings.FormatAttackSuccessText(),
                Settings.FormatDefaultBackground(),
                attackSuccessString);

            EffectSettings frozenEffectSettings = new EffectSettings {
                EffectHolder = player,
                MaxRound     = monster.Spellbook[index].Offensive.AmountMaxRounds,
                Name         = monster.Spellbook[index].Name
            };

            player.Effects.Add(new FrozenEffect(frozenEffectSettings));

            const string frozenString = "You are frozen. Physical, frost and arcane damage to you will be increased by 50%!";

            OutputHelper.Display.StoreUserOutput(
                Settings.FormatAttackSuccessText(),
                Settings.FormatDefaultBackground(),
                frozenString);
        }
    IEnumerator DoSkill11(Controller controller)//Slam
    {
        string tagName = Helper.GetTagEnemy(controller);

        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 11);

        GameObject prefab = GetSkillPrefab(skill.SkillId);

        CreateRangeOfSkill(controller.transform.position, skill.GameSkill.EffectRange);

        bool isplayskill = false;

        foreach (GameObject enemy in GameObject.FindGameObjectsWithTag(tagName))
        {
            float distance = Vector3.Distance(enemy.transform.position, controller.transform.position);

            if (distance <= skill.GameSkill.EffectRange)
            {
                isplayskill = true;
                GameObject spellObj = (GameObject)Instantiate(prefab, prefab.transform.position, Quaternion.identity) as GameObject;

                EffectSettings setting    = spellObj.GetComponent <EffectSettings>();
                int            skillIndex = controller.role.RoleSkills.IndexOf(skill);
                Debug.Log("skillIndex " + skillIndex);

                if (setting != null)
                {
                    setting.Target     = enemy;
                    setting.gameSkill  = skill;
                    setting.skillIndex = skillIndex;
                    setting.controller = controller;
                    //setting.damage = controller.skill_1_Value;
                    setting.audioEffect = null;
                }
            }
        }

        if (isplayskill)
        {
            SoundManager.Instance.PlaySkillBegin(skill, controller);
        }

        yield return(null);
    }
 private void CollisionEnter()
 {
     if (EffectOnHitObject!=null && hit.transform!=null) {
       var addMat = hit.transform.GetComponentInChildren<AddMaterialOnHit>();
       effectSettingsInstance = null;
       if (addMat!=null)
     effectSettingsInstance = addMat.gameObject.GetComponent<EffectSettings>();
       if (effectSettingsInstance != null)
     effectSettingsInstance.IsVisible = true;
       else {
     var hitGO = hit.transform;
     var renderer = hitGO.GetComponentInChildren<Renderer>();
     var effect = Instantiate(EffectOnHitObject) as GameObject;
     effect.transform.parent = renderer.transform;
     effect.transform.localPosition = Vector3.zero;
     effect.GetComponent<AddMaterialOnHit>().UpdateMaterial(hit);
     effectSettingsInstance = effect.GetComponent<EffectSettings>();
       }
     }
     effectSettings.OnCollisionHandler(new CollisionInfo {Hit = hit});
 }
	private void InstanceEffect(Vector3 pos)
	{
		currentGo = Instantiate(shot, pos, shot.transform.rotation) as GameObject;
		effectSettings = currentGo.GetComponent<EffectSettings>();
		effectSettings.Target = Target;
		if (isHomingMove) effectSettings.IsHomingMove = isHomingMove;
		prefabSpeed = effectSettings.MoveSpeed;
		effectSettings.EffectDeactivated+=effectSettings_EffectDeactivated;
		currentGo.transform.parent = go.transform;//transform;
		//effectSettings.CollisionEnter += (n, e) => { Debug.Log(e.Hit.transform.name); };
	}
Beispiel #37
0
 private void InstanceEffect(Vector3 pos)
 {
     currentGo = Instantiate(Prefabs[current], pos, Prefabs[current].transform.rotation) as GameObject;
     effectSettings = currentGo.GetComponent<EffectSettings>();
     effectSettings.Target = GetTargetObject(GuiStats[current]);
     effectSettings.EffectDeactivated += effectSettings_EffectDeactivated;
     if (GuiStats[current]==GuiStat.Middle) {
         currentGo.transform.parent = GetTargetObject(GuiStat.Middle).transform;
         currentGo.transform.position = GetInstancePosition(GuiStat.Middle);
     }
     else
         currentGo.transform.parent = transform;
     effectSettings.CollisionEnter += (n, e) => {
         if (e.Hit.transform!=null)
             Debug.Log(e.Hit.transform.name);
     };
 }
    // Use this for initialization
    void Awake()
    {
        //audioManager = GameObject.FindGameObjectWithTag("SoundManager").GetComponent<SoundManager>();
        if(readyPrefab!=null)
        {
            readyObject = Instantiate(readyPrefab, transform.position, transform.rotation) as GameObject;
            readyObject.transform.parent = transform;
            readyObject.transform.localPosition = new Vector3(firingTip.x, firingTip.y, 0f);
            readyObject.SetActive(false);
        }

        targetObject = Instantiate(targetPrefab, Vector3.zero, Quaternion.identity) as GameObject;
        particleObject = Instantiate(particlePrefab, transform.position, Quaternion.identity) as GameObject;

        particleScript = particleObject.GetComponent<EffectSettings>();
        particleScript.Target = targetObject;
        particleObject.transform.parent = transform;
        particleObject.transform.localRotation = Quaternion.identity;
        particleObject.transform.localPosition = new Vector3(firingTip.x, firingTip.y, 0f);
        line = particleObject.transform.FindChild("Trail").GetComponent<LineRenderer>();
        line2 = particleObject.transform.FindChild("GlowTrail").GetComponent<LineRenderer>();
        particleObject.SetActive(false);

        lastFireTime = -(1f/rateOfFire);

        currentHeat = 0f;

        thisRenderer = GetComponent<SpriteRenderer>();
    }