示例#1
0
        public Mine(Azul.Rect destRect, int owner, Azul.Color color)
            : base(GAMEOBJECT_TYPE.MINE, new Azul.Rect(0, 0, 12, 12), destRect, GameObject.mineTexture, color)
        {
            PhysicBody_Data data = new PhysicBody_Data();

            data.position = new Vec2(destRect.x, destRect.y);
            data.size     = new Vec2(destRect.width, destRect.height);
            //data.radius = 25f;
            data.isSensor   = true;
            data.angle      = 0;
            data.shape_type = PHYSICBODY_SHAPE_TYPE.DYNAMIC_BOX;

            ownerID = owner;

            lifeTime = 5.0f;

            armDelay = 2.0f;

            mine1 = pSprite;
            mine2 = new Azul.Sprite(GameObject.mineTexture2, new Azul.Rect(0, 0, 12, 12), destRect, new Azul.Color(1, 0, 0));

            drawMine2 = false;

            CreatePhysicBody(data);
            lifeTimer = new Stopwatch();

            animTimer = new Stopwatch();
            animTimer.Start();
            armedTimer = new Stopwatch();
            armedTimer.Start();


            state = MINE_STATE.LAYED;
        }
示例#2
0
        private void LayedUpdate()
        {
            TimeSpan ts = armedTimer.Elapsed;

            if (ts.Seconds > armDelay)
            {
                state = MINE_STATE.ARMED;
                lifeTimer.Start();
                AudioManager.PlaySoundEvent(AUDIO_EVENT.MINE_ARMED);
            }
        }