private Affector CreateNewAffector(AffectorType type)
    {
        GameObject go = new GameObject();

        go.name = "Affector_" + (int)type;
        Affector affector = AddAffectorComp(go, type);

        _mFreeAffectorList.Add(type, affector);
        return(affector);
    }
    public Affector GetAffector(AffectorType type)
    {
        // See if we have a list of this type:
        if (_mFreeAffectorList.ContainsKey(type))
        {
            return(_mFreeAffectorList[type]);
        }

        return(CreateNewAffector(type));
    }
    private Affector AddAffectorComp(GameObject go, AffectorType type)
    {
        Affector affector = null;

        switch (type)
        {
        case AffectorType.DELAY_FLY_UP:
            affector = go.AddComponent <AffectorDelayFlyUp>() as AffectorDelayFlyUp;
            break;

        case AffectorType.DELAY_FADE:
            affector = go.AddComponent <AffectorDelayFade>() as AffectorDelayFade;
            break;
        }

        return(affector);
    }
Exemple #4
0
        public AffectorWindow(AffectorType type)
        {
            InitializeComponent();

            switch (type)
            {
            case AffectorType.Colour:
                this.Text            = "Add Colour Affector";
                panelColour.Visible  = true;
                panelColour.Location = m_panelLocation;
                break;

            case AffectorType.Force:
                this.Text          = "Add Force Affector";
                panelForce.Visible = true;
                break;

            case AffectorType.Rotation:
                this.Text              = "Add Rotation Affector";
                panelRotation.Visible  = true;
                panelRotation.Location = m_panelLocation;
                break;

            case AffectorType.Scale:
                this.Text           = "Add Scale Affector";
                panelScale.Visible  = true;
                panelScale.Location = m_panelLocation;
                break;

            case AffectorType.Velocity:
                this.Text              = "Add Velocity Affector";
                panelVelocity.Visible  = true;
                panelVelocity.Location = m_panelLocation;
                break;
            }
            m_type           = type;
            this.Size        = new Size(300, 140);
            this.MinimumSize = this.Size;
            this.MaximumSize = this.Size;
        }
Exemple #5
0
        public AffectorWindow(AffectorType type)
        {
            InitializeComponent();

            switch (type)
            {
                case AffectorType.Colour:
                    this.Text = "Add Colour Affector";
                    panelColour.Visible = true;
                    panelColour.Location = m_panelLocation;
                    break;
                case AffectorType.Force:
                    this.Text = "Add Force Affector";
                    panelForce.Visible = true;
                    break;
                case AffectorType.Rotation:
                    this.Text = "Add Rotation Affector";
                    panelRotation.Visible = true;
                    panelRotation.Location = m_panelLocation;
                    break;
                case AffectorType.Scale:
                    this.Text = "Add Scale Affector";
                    panelScale.Visible = true;
                    panelScale.Location = m_panelLocation;
                    break;
                case AffectorType.Velocity:
                    this.Text = "Add Velocity Affector";
                    panelVelocity.Visible = true;
                    panelVelocity.Location = m_panelLocation;
                    break;
            }
            m_type = type;
            this.Size = new Size(300, 140);
            this.MinimumSize = this.Size;
            this.MaximumSize = this.Size;
        }