コード例 #1
0
    public void SetShadowOnGround()
    {
        GameObject shadow = ObjectPooler.Instance.GetPooledObject("Shadow");

        if (shadow != null)
        {
            shadow.transform.position = new Vector2(transform.position.x, shadow.transform.position.y);
            shadow.SetActive(true);
            sprite = shadow.GetComponent <ShadowSprite>();
        }
        else
        {
            Debug.LogWarning(shadow + " does not exist!");
            return;
        }
    }
コード例 #2
0
        public override void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            base.PostInitialize();
            if (mSpriteInstance.Parent == null)
            {
                mSpriteInstance.CopyAbsoluteToRelative();
                mSpriteInstance.AttachTo(this, false);
            }
            base.SpriteInstance.Texture                         = Stage2;
            base.SpriteInstance.LeftTexturePixel                = 3f;
            base.SpriteInstance.RightTexturePixel               = 142f;
            base.SpriteInstance.TopTexturePixel                 = 373f;
            base.SpriteInstance.BottomTexturePixel              = 760f;
            base.SpriteInstance.TextureScale                    = 0.5f;
            base.SpriteInstance.UseAnimationRelativePosition    = true;
            base.SpriteInstance.AnimationChains                 = Rabbit2Animations;
            base.SpriteInstance.CurrentChainName                = "Running";
            base.SpriteInstance.IgnoreAnimationChainTextureFlip = true;
            if (mCircleInstance.Parent == null)
            {
                mCircleInstance.CopyAbsoluteToRelative();
                mCircleInstance.AttachTo(this, false);
            }
            base.CircleInstance.Radius = 16f;
            if (LightSprite.Parent == null)
            {
                LightSprite.CopyAbsoluteToRelative();
                LightSprite.AttachTo(this, false);
            }
            base.LightSprite.Texture            = AllAssetsSheet;
            base.LightSprite.LeftTexturePixel   = 1792f;
            base.LightSprite.RightTexturePixel  = 2048f;
            base.LightSprite.TopTexturePixel    = 1792f;
            base.LightSprite.BottomTexturePixel = 2048f;
            base.LightSprite.TextureScale       = 0.5f;
            if (ShadowSprite.Parent == null)
            {
                ShadowSprite.CopyAbsoluteToRelative();
                ShadowSprite.AttachTo(this, false);
            }
            if (ShadowSprite.Parent == null)
            {
                base.ShadowSprite.Y = -32f;
            }
            else
            {
                base.ShadowSprite.RelativeY = -32f;
            }
            if (ShadowSprite.Parent == null)
            {
                base.ShadowSprite.Z = -1f;
            }
            else
            {
                base.ShadowSprite.RelativeZ = -1f;
            }
            base.ShadowSprite.Texture            = AllParticles;
            base.ShadowSprite.LeftTexturePixel   = 1019f;
            base.ShadowSprite.RightTexturePixel  = 1072f;
            base.ShadowSprite.TopTexturePixel    = 1895f;
            base.ShadowSprite.BottomTexturePixel = 1948f;
            base.ShadowSprite.TextureScale       = 1f;
            base.ShadowSprite.Width  = 48f;
            base.ShadowSprite.Height = 16f;
            #if FRB_MDX
            ShadowSprite.ColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.Modulate;
            #else
            base.ShadowSprite.ColorOperation = FlatRedBall.Graphics.ColorOperation.Modulate;
            #endif
            base.ShadowSprite.Alpha = 0.3f;
            if (PoisonedParticles.Parent == null)
            {
                PoisonedParticles.CopyAbsoluteToRelative();
                PoisonedParticles.AttachTo(this, false);
            }
            if (FrozenParticles.Parent == null)
            {
                FrozenParticles.CopyAbsoluteToRelative();
                FrozenParticles.AttachTo(this, false);
            }
            if (SmokeParticles.Parent == null)
            {
                SmokeParticles.CopyAbsoluteToRelative();
                SmokeParticles.AttachTo(this, false);
            }
            if (StunParticles.Parent == null)
            {
                StunParticles.CopyAbsoluteToRelative();
                StunParticles.AttachTo(this, false);
            }
            mGeneratedCollision = new FlatRedBall.Math.Geometry.ShapeCollection();
            mGeneratedCollision.Circles.AddOneWay(mCircleInstance);
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }