aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs
blob: 8508dac22be60547b005531d72afe14e79cc163e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Region.Environment.Scenes;
using libsecondlife;
using OpenSim.Framework.Types;
using System.Timers;

namespace SimpleApp
{
    public class MySceneObject : SceneObject
    {
        LLVector3 delta = new LLVector3(0.1f, 0.1f, 0.1f);
        
        public MySceneObject(Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
            : base(world, ownerID, localID, pos, shape )
        {
            Timer timer = new Timer();
            timer.Enabled = true;
            timer.Interval = 100;
            timer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
        }

        public void Heartbeat(object sender, EventArgs e)
        {
            if (rootPrimitive.Scale.X > 1)
            {
                delta = new LLVector3(-0.1f, -0.1f, -0.1f);
            }

            if (rootPrimitive.Scale.X < 0.2f)
            {
                delta = new LLVector3(0.1f, 0.1f, 0.1f);
            }

            rootPrimitive.ResizeGoup(rootPrimitive.Scale + delta);
            update();
        }
    }
}