public SpriteComponentState(bool visible, DrawDepth drawDepth, string spriteKey, string baseName)
     : base(drawDepth, null)
 {
     Visible   = visible;
     SpriteKey = spriteKey;
     BaseName  = baseName;
 }
 public WearableAnimatedSpriteComponentState(bool isCurrentlyWorn, bool isCurrentlyCarried,
                                             bool visible, DrawDepth drawDepth, string name, string currentAnimation, bool loop, EntityUid?masterUid)
     : base(visible, drawDepth, name, currentAnimation, loop, masterUid, NetIDs.WEARABLE_ANIMATED_SPRITE)
 {
     IsCurrentlyWorn    = isCurrentlyWorn;
     IsCurrentlyCarried = isCurrentlyCarried;
 }
 public SpriteComponentState(bool visible, DrawDepth drawDepth, string spriteKey, string baseName)
     : base(drawDepth, null)
 {
     Visible = visible;
     SpriteKey = spriteKey;
     BaseName = baseName;
 }
Esempio n. 4
0
 public AnimatedSpriteComponentState(bool visible, DrawDepth drawDepth, string name, string currentAnimation, bool loop, int?masterUid)
     : base(drawDepth, masterUid)
 {
     Visible          = visible;
     CurrentAnimation = currentAnimation;
     Loop             = loop;
     Name             = name;
 }
 public AnimatedSpriteComponentState(bool visible, DrawDepth drawDepth, string name, string currentAnimation, bool loop, int? masterUid)
     : base(drawDepth, masterUid)
 {
     Visible = visible;
     CurrentAnimation = currentAnimation;
     Loop = loop;
     Name = name;
 }
Esempio n. 6
0
 public SpriteComponentState(bool visible, DrawDepth drawDepth, string spriteKey, string baseName, Vector2 offset)
     : base(drawDepth, null, NetIDs.SPRITE)
 {
     Visible   = visible;
     SpriteKey = spriteKey;
     BaseName  = baseName;
     Offset    = offset;
 }
 public AnimatedSpriteComponentState(bool visible, DrawDepth drawDepth, string name, string currentAnimation,
                                     bool loop, int?masterUid, uint netID = NetIDs.ANIMATED_SPRITE)
     : base(drawDepth, masterUid, netID)
 {
     Visible          = visible;
     CurrentAnimation = currentAnimation;
     Loop             = loop;
     Name             = name;
 }
        public override void LoadParameters(Dictionary <string, YamlNode> mapping)
        {
            YamlNode node;

            if (mapping.TryGetValue("drawdepth", out node))
            {
                DrawDepth = node.AsEnum <DrawDepth>();
            }

            if (mapping.TryGetValue("sprite", out node))
            {
                SpriteName = node.AsString();
            }
        }
Esempio n. 9
0
        public override void SetParameter(ComponentParameter parameter)
        {
            base.SetParameter(parameter);
            switch (parameter.MemberName)
            {
            case "drawdepth":
                DrawDepth = (DrawDepth)Enum.Parse(typeof(DrawDepth), parameter.GetValue <string>(), true);
                break;

            case "sprite":
                Name = parameter.GetValue <string>();
                break;
            }
        }
        public override void LoadParameters(YamlMappingNode mapping)
        {
            YamlNode node;

            if (mapping.TryGetNode("drawdepth", out node))
            {
                DrawDepth = node.AsEnum <DrawDepth>();
            }

            if (mapping.TryGetNode("sprite", out node))
            {
                SpriteName = node.AsString();
            }
        }
        public override void SetParameter(ComponentParameter parameter)
        {
            base.SetParameter(parameter);
            switch (parameter.MemberName)
            {
                case "drawdepth":
                    DrawDepth = (DrawDepth)Enum.Parse(typeof(DrawDepth), parameter.GetValue<string>(), true);
                    break;

                case "sprite":
                    Name = parameter.GetValue<string>();
                    break;
            }
        }
Esempio n. 12
0
 public SpriteComponentState(
     bool visible,
     DrawDepth drawDepth,
     Vector2 scale,
     Angle rotation,
     Vector2 offset,
     Color color,
     bool directional,
     string baseRsiPath,
     List <Layer> layers)
     : base(NetIDs.SPRITE)
 {
     Visible     = visible;
     DrawDepth   = drawDepth;
     Scale       = scale;
     Rotation    = rotation;
     Offset      = offset;
     Color       = color;
     Directional = directional;
     BaseRsiPath = baseRsiPath;
     Layers      = layers;
 }
Esempio n. 13
0
    private void SetupCamera()
    {
        CreateDepthCamera();

        coneCameraTransform.position = transform.position;
        coneCameraTransform.rotation = Quaternion.LookRotation(-transform.up, transform.forward);
        coneCamera.farClipPlane      = coneHeight;
        coneCamera.nearClipPlane     = 0.01f;
        coneCamera.fieldOfView       = coneAngle;
        coneCamera.clearFlags        = CameraClearFlags.SolidColor;
        coneCamera.backgroundColor   = Color.black;
        coneCamera.targetTexture     = ConeRenderTexture();

#if UNITY_EDITOR
        //UnityEditor.EditorUtility.SetDirty(coneCameraTransform);
        //UnityEditor.SceneView.RepaintAll();
        DrawDepth drawDepth = coneCameraTransform.GetComponent <DrawDepth>();
        if (drawDepth == null)
        {
            drawDepth = coneCameraTransform.gameObject.AddComponent <DrawDepth>();
        }
        drawDepth.DoDepthRender();
#endif
    }
Esempio n. 14
0
 private void SendDrawDepth(DrawDepth dd)
 {
     Owner.SendMessage(this, ComponentMessageType.SetWornDrawDepth, dd);
 }
        public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type,
                                                             params object[] list)
        {
            ComponentReplyMessage reply = base.RecieveMessage(sender, type, list);

            if (sender == this) //Don't listen to our own messages!
                return ComponentReplyMessage.Empty;

            switch (type)
            {
                case ComponentMessageType.MoveDirection:
                    switch ((Direction) list[0])
                    {
                        case Direction.North:
                            if (worn)
                            {
                                SetSpriteByKey(_basename + "_back");
                                flip = false;
                            }
                            else
                                SetSpriteByKey(_basename);
                            break;
                        case Direction.South:
                            if (worn)
                            {
                                SetSpriteByKey(_basename + "_front");
                                flip = false;
                            }
                            else
                                SetSpriteByKey(_basename);

                            break;
                        case Direction.East:
                            if (worn)
                            {
                                SetSpriteByKey(_basename + "_side");
                                flip = true;
                            }
                            else
                                SetSpriteByKey(_basename);
                            break;
                        case Direction.West:
                            if (worn)
                            {
                                SetSpriteByKey(_basename + "_side");
                                flip = false;
                            }
                            else
                                SetSpriteByKey(_basename);
                            break;
                        case Direction.NorthEast:
                            if (worn)
                            {
                                SetSpriteByKey(_basename + "_back");
                                flip = false;
                            }
                            else
                                SetSpriteByKey(_basename);
                            break;
                        case Direction.NorthWest:
                            if (worn)
                            {
                                SetSpriteByKey(_basename + "_back");
                                flip = false;
                            }
                            else
                                SetSpriteByKey(_basename);
                            break;
                        case Direction.SouthEast:
                            if (worn)
                            {
                                SetSpriteByKey(_basename + "_front");
                                flip = false;
                            }
                            else
                                SetSpriteByKey(_basename);
                            break;
                        case Direction.SouthWest:
                            if (worn)
                            {
                                SetSpriteByKey(_basename + "_front");
                                flip = false;
                            }
                            else
                                SetSpriteByKey(_basename);
                            break;
                    }
                    DrawDepth = wornDrawDepth;
                    break;
                case ComponentMessageType.Incapacitated:
                case ComponentMessageType.WearerIsDead:
                    SetSpriteByKey(_basename + "_incap");
                    flip = false;
                    break; //TODO do stuff here, incap and dead.
                case ComponentMessageType.ItemEquipped:
                    worn = true;
                    DrawDepth = wornDrawDepth;
                    break;
                case ComponentMessageType.ItemUnEquipped:
                    worn = false;
                    break;
                case ComponentMessageType.SetWornDrawDepth:
                    wornDrawDepth = (DrawDepth) list[0];
                    break;
            }

            return reply;
        }
 private void SendDrawDepth(DrawDepth dd)
 {
     Owner.SendMessage(this, ComponentMessageType.SetWornDrawDepth, dd);
 }
Esempio n. 17
0
 protected void SetDrawDepth(DrawDepth p)
 {
     DrawDepth = p;
 }
 public WearableAnimatedSpriteComponentState(bool isCurrentlyWorn, bool isCurrentlyCarried, bool visible, DrawDepth drawDepth, string name, string currentAnimation, bool loop, int? masterUid)
     : base(visible, drawDepth, name, currentAnimation, loop, masterUid)
 {
     IsCurrentlyWorn = isCurrentlyWorn;
     IsCurrentlyCarried = isCurrentlyCarried;
 }
Esempio n. 19
0
 protected void SetDrawDepth(DrawDepth p)
 {
     DrawDepth = p;
 }
 public WearableAnimatedSpriteComponentState(bool isCurrentlyWorn, bool isCurrentlyCarried, bool visible, DrawDepth drawDepth, string name, string currentAnimation, bool loop, int?masterUid)
     : base(visible, drawDepth, name, currentAnimation, loop, masterUid)
 {
     IsCurrentlyWorn    = isCurrentlyWorn;
     IsCurrentlyCarried = isCurrentlyCarried;
 }
 public RenderableComponentState(DrawDepth drawDepth, int?masterUid) :
     base(ComponentFamily.Renderable)
 {
     DrawDepth = drawDepth;
     MasterUid = masterUid;
 }
 public RenderableComponentState(DrawDepth drawDepth, int? masterUid)
     : base(ComponentFamily.Renderable)
 {
     DrawDepth = drawDepth;
     MasterUid = masterUid;
 }
Esempio n. 23
0
        public override ComponentReplyMessage RecieveMessage(object sender, ComponentMessageType type,
                                                             params object[] list)
        {
            ComponentReplyMessage reply = base.RecieveMessage(sender, type, list);

            if (sender == this) //Don't listen to our own messages!
            {
                return(ComponentReplyMessage.Empty);
            }

            switch (type)
            {
            case ComponentMessageType.MoveDirection:
                switch ((Direction)list[0])
                {
                case Direction.North:
                    if (worn)
                    {
                        SetSpriteByKey(_basename + "_back");
                        flip = false;
                    }
                    else
                    {
                        SetSpriteByKey(_basename);
                    }
                    break;

                case Direction.South:
                    if (worn)
                    {
                        SetSpriteByKey(_basename + "_front");
                        flip = false;
                    }
                    else
                    {
                        SetSpriteByKey(_basename);
                    }

                    break;

                case Direction.East:
                    if (worn)
                    {
                        SetSpriteByKey(_basename + "_side");
                        flip = true;
                    }
                    else
                    {
                        SetSpriteByKey(_basename);
                    }
                    break;

                case Direction.West:
                    if (worn)
                    {
                        SetSpriteByKey(_basename + "_side");
                        flip = false;
                    }
                    else
                    {
                        SetSpriteByKey(_basename);
                    }
                    break;

                case Direction.NorthEast:
                    if (worn)
                    {
                        SetSpriteByKey(_basename + "_back");
                        flip = false;
                    }
                    else
                    {
                        SetSpriteByKey(_basename);
                    }
                    break;

                case Direction.NorthWest:
                    if (worn)
                    {
                        SetSpriteByKey(_basename + "_back");
                        flip = false;
                    }
                    else
                    {
                        SetSpriteByKey(_basename);
                    }
                    break;

                case Direction.SouthEast:
                    if (worn)
                    {
                        SetSpriteByKey(_basename + "_front");
                        flip = false;
                    }
                    else
                    {
                        SetSpriteByKey(_basename);
                    }
                    break;

                case Direction.SouthWest:
                    if (worn)
                    {
                        SetSpriteByKey(_basename + "_front");
                        flip = false;
                    }
                    else
                    {
                        SetSpriteByKey(_basename);
                    }
                    break;
                }
                DrawDepth = wornDrawDepth;
                break;

            case ComponentMessageType.Incapacitated:
            case ComponentMessageType.WearerIsDead:
                SetSpriteByKey(_basename + "_incap");
                flip = false;
                break;     //TODO do stuff here, incap and dead.

            case ComponentMessageType.ItemEquipped:
                worn      = true;
                DrawDepth = wornDrawDepth;
                break;

            case ComponentMessageType.ItemUnEquipped:
                worn = false;
                break;

            case ComponentMessageType.SetWornDrawDepth:
                wornDrawDepth = (DrawDepth)list[0];
                break;
            }

            return(reply);
        }
Esempio n. 24
0
 public RenderableComponentState(DrawDepth drawDepth, EntityUid?masterUid, uint netID) :
     base(netID)
 {
     DrawDepth = drawDepth;
     MasterUid = masterUid;
 }