示例#1
0
        public void FaceDirection(CardinalOrientation dir)
        {
            if (LastOrientation != dir)
            {
                LastOrientation = dir;
                switch (LastOrientation)
                {
                case CardinalOrientation.South:
                {
                    Anim.SetFloat("Direction", 0.0f);
                    break;
                }

                case CardinalOrientation.East:
                {
                    Anim.SetFloat("Direction", 0.4f);
                    break;
                }

                case CardinalOrientation.North:
                {
                    Anim.SetFloat("Direction", 0.7f);
                    break;
                }

                case CardinalOrientation.West:
                {
                    Anim.SetFloat("Direction", 1.0f);
                    break;
                }
                }
            }
        }
示例#2
0
        public void InitialiseEntity(String id, int x, int y, CardinalOrientation orientation)
        {
            // SET the _entityID using the property EntityID
            EntityID = id;
            // Declare local variable of type vector pass in the x and y to the x and y of
            // the vector class
            var vector = new Vector2(x, y);

            // SET the position of the entity using the Position property.
            Position = vector;
            // SET the orientation of the entity using the Orientation property
            Orientation = orientation;
        }