コード例 #1
0
        private void SelectNewEffect(IceEffect effect)
        {
            bool paramtersBoxEnabled = false;

            comboBoxParameters.Items.Clear();
            comboBoxParameters.SelectedItem = null;
            comboBoxParameters.SelectedText = "";
            comboBoxParameters.Text         = "";
            // if the effect is a new one
            if (effect != PostProcessAnimation.IceEffect)
            {
                PostProcessAnimation.IceEffect = effect;
                // load the default properties for this effect
                for (int i = 0; i < 8; i++)
                {
                    LinearProperty selectedLinearProperty = PostProcessAnimation.LinearProperties[i];
                    if (effect.ParametersProperties != null && i < effect.ParametersProperties.Length &&
                        effect.ParametersProperties[i] != null)
                    {
                        // use the effect's default linear property
                        effect.ParametersProperties[i].CopyValuesTo(selectedLinearProperty);
                    }
                    else
                    {
                        selectedLinearProperty = new LinearProperty(0, String.Empty, 0, 10);
                    }
                }
            }
            if (PostProcessAnimation.IceEffect.ParametersProperties != null)
            {
                for (int i = 0; i < PostProcessAnimation.IceEffect.ParametersProperties.Length; i++)
                {
                    if (PostProcessAnimation.IceEffect.ParametersProperties[i] != null)
                    {
                        comboBoxParameters.Items.Add(PostProcessAnimation.IceEffect.ParametersProperties[i].Description);
                    }
                }
                // select the first index if possible
                if (PostProcessAnimation.IceEffect.ParametersProperties.Length >= 1)
                {
                    comboBoxParameters.SelectedIndex = 0;
                    paramtersBoxEnabled = true;
                }
            }
            if (paramtersBoxEnabled == false)
            {
                comboBoxParameters.Enabled    = false;
                labelParameters.Enabled       = false;
                linearPropertyControl.Visible = false;
            }
            else
            {
                comboBoxParameters.Enabled    = true;
                labelParameters.Enabled       = true;
                linearPropertyControl.Visible = true;
            }
        }
コード例 #2
0
ファイル: IceGun.cs プロジェクト: AtwoodDeng/miniRTS
    public override Damage GetDamage(Robot _robot)
    {
        IceEffect e = new IceEffect();

        e.Init(weaponParameter.PPercentage, weaponParameter.Parameter1, weaponParameter.PTime);
        Damage dmg = new Damage(_robot, weaponParameter.Damage, weaponParameter.DamageType);

        dmg.AddEffect(e);
        return(dmg);
    }
コード例 #3
0
 private TreeNode GetEffectNode(IceEffect effect)
 {
     // check all the embedded effects first
     for (int i = 0; i < DrawingManager.EmbeddedIceEffects.Length; i++)
     {
         if (DrawingManager.EmbeddedIceEffects[i] == effect)
         {
             return(treeviewEffects.Nodes[0].Nodes[i]);
         }
     }
     // return the first embedded ice effect if none was found
     return(treeviewEffects.Nodes[0].Nodes[0]);
 }
コード例 #4
0
        public static void Enemy()
        {
            enemyUnits.Wave = new NormalWave();
            enemyUnits.Start(1);
            enemyUnits.Attack();
            Unit          unit  = new GoldUnit(1);
            Effect        tower = new IceEffect(unit);
            EffectHistory hist  = new EffectHistory();

            if (tower.Execute())
            {
                hist.AddEffect(tower);
            }
            hist.UndoEffect();
        }
コード例 #5
0
    protected override void OnDestroy()
    {
        //print ("From: " + startingPos + " To: " + this.transform.position);
        //print ("Distance: " + Vector3.Distance(startingPos, this.transform.position));
        GameObject ice   = (GameObject)Instantiate(Resources.Load("Particles/Ice"), this.transform.position - new Vector3(0, 0.4f, 0), Quaternion.identity);
        float      scale = 1 + (charge * 5);

        ice.transform.localScale += new Vector3(scale, 0, scale);
        ParticleSystem[] clouds = ice.GetComponentsInChildren <ParticleSystem> ();
        clouds [0].startSize    += charge;
        clouds [0].emissionRate += 120 * (1 + charge);
        clouds [0].particleSystem.Simulate(1);
        clouds [0].Play();
        IceEffect effect = ice.AddComponent <IceEffect>();

        effect.Initialize(owner, charge);
    }
コード例 #6
0
        private void PostProcessAnimationEditor_Load(object sender, EventArgs e)
        {
            // populate the iceeffects treeview nodes
            for (int i = 0; i < (int)EmbeddedIceEffectType.SizeOfEnum; i++)
            {
                TreeNode lastNode = treeviewEffects.Nodes[0].Nodes.Add(((EmbeddedIceEffectType)i).ToString());
                lastNode.Tag = DrawingManager.EmbeddedIceEffects[i];
            }

            for (int i = 0; i < (int)SceneManager.GlobalDataHolder.Effects.Count; i++)
            {
                IceEffect eff      = SceneManager.GlobalDataHolder.Effects[i];
                TreeNode  lastNode = treeviewEffects.Nodes[1].Nodes.Add(eff.Name);
                lastNode.Tag = eff;
            }
            // select the corresponding effect node
            treeviewEffects.SelectedNode = GetEffectNode(PostProcessAnimation.IceEffect);
            textBoxLife.Text             = PostProcessAnimation.Life.ToString(CultureInfo.InvariantCulture);
            textBoxLoopAmount.Text       = PostProcessAnimation.LoopMax.ToString(CultureInfo.InvariantCulture);
            // load the background sample image
            postProcessAnimControl.LoadBackground(Texture2D.FromFile(
                                                      postProcessAnimControl.GraphicsDevice, Application.StartupPath + "\\Resources\\ppBackground.jpg"));
        }
コード例 #7
0
 public PostProcessAnimation(IceEffect iceEffect)
 {
     _iceEffect                     = iceEffect;
     _iceEffectParameters           = new IceEffectParameters();
     _ppRequest                     = new PostProcessRequest();
     _ppRequest.IceEffect           = _iceEffect;
     _ppRequest.IceEffectParameters = _iceEffectParameters;
     _linearProperties              = new LinearProperty[8];
     for (int i = 0; i < _linearProperties.Length; i++)
     {
         _linearProperties[i] = new LinearProperty(1.0f, "Parameter " + i, 0, 10);
     }
     _currentLife         = 0;
     _life                = 1;
     _currentLife         = 0;
     _maxLife             = _life * 60;
     _loopMax             = 0;
     _loopCounter         = 0;
     _isPaused            = false;
     _isStopped           = false;
     this.AutoPlay        = true;
     this.HideWhenStopped = true;
 }
コード例 #8
0
    public void AddEffect(ElementalType type, int shapeId)
    {
        Debug.Log("Add effect: " + gameObject.tag);
        switch (type)
        {
        case ElementalType.fire:
            FireEffect fireEffect = new FireEffect();

            fireEffect.spellType = ElementalType.fire;
            fireEffect.shapeId   = shapeId;
            fireEffect.monster   = gameObject;

            fireEffect.InitEffect(10f, 1f, 5f, 1f, 10f);

            spellEffects.Add(fireEffect);
            break;

        case ElementalType.ice:
            IceEffect iceEffect = new IceEffect();

            iceEffect.spellType = ElementalType.ice;
            iceEffect.shapeId   = shapeId;
            iceEffect.monster   = gameObject;

            iceEffect.InitEffect(10f, 1f, 0.5f, 5f);

            spellEffects.Add(iceEffect);
            break;

        case ElementalType.earth:
            earthEffect earthEffect = new earthEffect();

            earthEffect.spellType = ElementalType.earth;
            earthEffect.shapeId   = shapeId;
            earthEffect.monster   = gameObject;

            earthEffect.InitEffect(10f, 1f, 5f, 1f, 10f);

            spellEffects.Add(earthEffect);
            break;

        case ElementalType.death:
            deathEffect deathEffect = new deathEffect();

            deathEffect.spellType = ElementalType.death;
            deathEffect.shapeId   = shapeId;
            deathEffect.monster   = gameObject;

            deathEffect.InitEffect(10f, 1f, 5f, 1f, 10f);

            spellEffects.Add(deathEffect);
            break;

        case ElementalType.poison:
            poisonEffect poisonEffect = new poisonEffect();

            poisonEffect.spellType = ElementalType.poison;
            poisonEffect.shapeId   = shapeId;
            poisonEffect.monster   = gameObject;

            poisonEffect.InitEffect(10f, 1f, 5f, 1f, 10f);

            spellEffects.Add(poisonEffect);
            break;

        default:
            break;
        }
    }