Ejemplo n.º 1
0
        public override GameObject GetGameObject(GameObjectCoords objectCoords)
        {
            GameObject groundObject = new GroundObject()
            {
                Shape = GameSettings.Ground, GameObjectCoords = objectCoords, GameObjectType = GameObjectType.GroundObject
            };

            return(groundObject);
        }
Ejemplo n.º 2
0
        public override GameObject GetGameObject(GameObjectPlace objectPlace)
        {
            GameObject groundObject = new GroundObject()
            {
                Figure = GameSettings.Ground, GameObjectPlace = objectPlace, GameObjectType = GameObjectType.GroundObject
            };

            return(groundObject);
        }
Ejemplo n.º 3
0
    // Adds a GroundObject at xCooridate. Updates nextBlockCoordinate to xCoordinate
    void AddGroundObject(float xCoordinate)
    {
        GameObject   newObject       = (GameObject)Instantiate(groundObject, new Vector3(xCoordinate, yCoordinate, zCoordinate), transform.rotation);
        GroundObject newGroundObject = newObject.GetComponent <GroundObject>();

        newGroundObject.Init(this);
        groundObjects.Enqueue(newGroundObject);

        nextBlockCoordinate = xCoordinate;
    }
        public static void Test()
        {
            List <IMapObject> listOfObjects = new List <IMapObject>();

            MapObject    mapObject    = new MapObject();
            WallObject   wallObject   = new WallObject();
            GroundObject groundObject = new GroundObject();

            listOfObjects.Add(mapObject);
            listOfObjects.Add(wallObject);
        }
        public CharacterAnimationSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            GraphicsScreen.ClearBackground = true;
            GraphicsScreen.BackgroundColor = Color.CornflowerBlue;
            SetCamera(new Vector3F(0, 1, 3), 0, 0);

            // Add gravity and damping to the physics simulation.
            // Note: The physics simulation is only used by the ragdoll samples.
            Simulation.ForceEffects.Add(new Gravity());
            Simulation.ForceEffects.Add(new Damping());

            // Add a ground object.
            _groundObject = new GroundObject(Services);
            GameObjectService.Objects.Add(_groundObject);
        }
Ejemplo n.º 6
0
    private void SpawnGrass()
    {
        for (float x = -_sizeX; x <= _sizeX; x++)
        {
            for (float y = -_sizeY; y <= _sizeY; y++)
            {
                float floatDistance = Vector2.Distance(_centerPos, new Vector2(x, y));
                floatDistance = floatDistance / 2;
                int intDistance = Mathf.RoundToInt(floatDistance);

                if (intDistance >= _grass.Count)
                {
                    intDistance = _grass.Count - 1;
                }
                GroundObject grass = Instantiate(_grass[intDistance], new Vector3(x, y, 0), transform.rotation = Quaternion.Euler(0, 0, Random.RandomRange(0, 360)));
            }
        }
    }
    public void ButtonInput(string input)
    {
        GroundObject other = (GroundObject)groundObject.GetComponent(typeof(GroundObject));


        switch (input)
        {
        case "right":
            movingRight = true;
            break;

        case "left":
            movingLeft = true;
            break;

        case "right-up":
            movingRight = false;
            break;

        case "left-up":
            movingLeft = false;
            break;

        case "jump":
            //if (other.canJumpFunction())
            if (canJump)
            {
                rigidBody.AddForce(transform.up * jumpForce);
            }
            break;

        case "interact":
            if (isActivatedSphere1)
            {
                movingPlatform1.transform.position = new Vector3(movingPlatform1.transform.position.x, movingPlatform1.transform.position.y - 3, movingPlatform1.transform.position.z);
            }
            if (isActivatedSphere2)
            {
                movingPlatform2.transform.position = new Vector3(movingPlatform2.transform.position.x, movingPlatform2.transform.position.y - 3, movingPlatform2.transform.position.z);
            }
            break;
        }
    }
        //public IMapObject[,] level1 = new IMapObject[28,112];


        public static IMapObject[,] LoadMapWithObjects(Level level)
        {
            IMapObject[,] objectRenderedMap = new IMapObject[28, 112];

            for (int y = 0; y < level.LevelAsCharArray.GetLength(1); y++)
            {
                for (int x = 0; x < level.LevelAsCharArray.GetLength(0); x++)
                {
                    PositionOnMap currentPosition = new PositionOnMap {
                        X = x, Y = y
                    };
                    char symbol = level.LevelAsCharArray[x, y];

                    switch (symbol)
                    {
                    case '|':
                        objectRenderedMap[x, y] = new WallObject(symbol, currentPosition);
                        break;

                    case '@':
                        objectRenderedMap[x, y] = new PlayerObject(symbol, currentPosition);
                        break;

                    case 'T':
                        objectRenderedMap[x, y] = new GroundObject(symbol, currentPosition);
                        break;

                    case ' ':
                        objectRenderedMap[x, y] = new MapObject(symbol, currentPosition);
                        break;

                    case '_':
                        objectRenderedMap[x, y] = new RoofObject(symbol, currentPosition);
                        break;

                    default:
                        break;
                    }
                }
            }
            return(objectRenderedMap);
        }
Ejemplo n.º 9
0
        //===================================
        //  Custscene stuff
        //===================================


        //===================================
        // Objects and Characters
        //===================================
        public object CreateObject(string objtype, string instancename, int x, int y, int w, int h)
        {
            GroundMap map = ZoneManager.Instance.CurrentGround;

            if (map == null)
            {
                DiagManager.Instance.LogInfo(String.Format("ScriptGround.CreateObject({0}, {1}, {2}, {3}, {4}, {5}) : No ground map loaded!", objtype, instancename, x, y, w, h));
                return(null);
            }

            GroundObject groundobject = null;
            var          template     = TemplateManager.Instance.FindTemplate(objtype); //Templates are created by the modders, and stored as data (This is handy, because its pretty certain a lot of characters and entities will be repeated throughout the maps)

            if (template == null)
            {
                return(null);
            }

            groundobject        = (GroundObject)template.create(instancename);
            groundobject.Bounds = new Rect(x, y, w, h);
            groundobject.AddScriptEvent(LuaEngine.EEntLuaEventTypes.Action);
            map.AddObject(groundobject);
            return(groundobject); //Object's properties can be tweaked later on
        }
Ejemplo n.º 10
0
 internal void SetGround(GroundObject groundInfiniteObject)
 {
     this.m_Ground = groundInfiniteObject;
 }