Exemplo n.º 1
0
        public override void TriggerAction(int objectHash)
        {
            if (!_gameController.IsGameRun)
            {
                return;
            }
            GameObjectEnum objectType = GameObjectEnum.GroundTitle;
            Rigidbody      objectInTrigger;

            if (groundTitles.TryGetValue(objectHash, out objectInTrigger))
            {
                if (_startTitleHash != 0 && objectHash == _startTitleHash)
                {
                    groundTitles[_startTitleHash].transform.localScale -= (Vector3.right * 2 + Vector3.forward * 2) * _groundTitleOffset;
                    _startTitleHash = 0;
                }
                groundTitles.Remove(objectHash);
                BuildGameField();
            }
            else
            {
                if (!crystalTitles.TryGetValue(objectHash, out objectInTrigger))
                {
                    return;
                }
                objectType = GameObjectEnum.CrystaleTitle;
                crystalTitles.Remove(objectHash);
            }

            _pool.ReturnObjectInPool(objectType, objectInTrigger);
        }
Exemplo n.º 2
0
    public IView CreateView(int x, int y, GameObjectEnum type)
    {
        var obj = Create(type);

        obj.transform.SetParent(transform);
        obj.transform.localPosition = new Vector2(x, y);
        return(obj.GetComponent <IView>());
    }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ObjectType"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        public BaseGameObject(GameObjectEnum ObjectType,float x, float y, float width, float height)
        {
            this.objType = ObjectType;
            this.xPos = x;
            this.yPos = y;
            this.width = width;
            this.height = height;

            this.isAlive = true;
        }
Exemplo n.º 4
0
    ObjectView Create(GameObjectEnum type)
    {
        switch (type)
        {
        case GameObjectEnum.Wall:
            return(Instantiate(_wall));

        case GameObjectEnum.Player:
            return(Instantiate(_player));

        default:
            throw new NotImplementedException();
        }
    }
Exemplo n.º 5
0
        public static GameObject Create(GameObjectEnum gameObjectEnum)
        {
            GameObject go = new GameObject();

            switch (gameObjectEnum)
            {
            case GameObjectEnum.Bullet:
                go = new Bullet();
                break;

            case GameObjectEnum.Enemy:
                go = new Enemy();
                break;
            }
            return(go);
        }
Exemplo n.º 6
0
 public GameObject GetGameObject(GameObjectEnum enums)
 {
     using (var db = new SQLite.SQLiteConnection(Constants.DbPath))
     {
         GameObject newObject = new GameObject();
         try
         {
             newObject = (db.Table<GameObject>().Where(
                         g => g.GameObjectId == (int)enums )).SingleOrDefault();
         }
         catch
         {
             newObject = null;
         }
         return newObject;
     }
 }
Exemplo n.º 7
0
        public void UseObject(Game1 game, GameObjectEnum gameObjectEnum)
        {
            int MAX_VALUE = 100;
            int MED_VALUE = 50;

            Pet _pet = _petRepository.GetPet();
            if (_pet.Sleeping)
            {
                return;
            }
            switch (gameObjectEnum)
            {
                case GameObjectEnum.Apple:
                    {
                        if (_pet.Hunger < MAX_VALUE)
                        {
                            UpdatePet(_pet, gameObjectEnum);
                            game._graphicsEnum = Content.Graphics.GraphicsEnum.EatingAnim;
                        }
                        else
                        {
                            //Saytext Method
                        }
                    }
                    break;
                case GameObjectEnum.Ball:
                    {
                        if (_pet.Mood < MAX_VALUE && _pet.Energy > 0 && _pet.Hunger > 0)
                        {
                            UpdatePet(_pet, gameObjectEnum);
                            //game._graphicsEnum = Content.Graphics.GraphicsEnum.Player;
                        }
                        else
                        {
                            //Saytext Method
                        }
                    }
                    break;
                case GameObjectEnum.Book:
                    {
                        if (_pet.Discipline < MAX_VALUE && _pet.Energy > 0 && _pet.Hunger > 0)
                        {
                            UpdatePet(_pet, gameObjectEnum);
                            //game._graphicsEnum = Content.Graphics.GraphicsEnum.Read;
                        }
                        else
                        {
                            //Saytext Method
                        }
                    }
                    break;
                case GameObjectEnum.Burger:
                    {
                        if (_pet.Hunger < MAX_VALUE)
                        {
                            UpdatePet(_pet, gameObjectEnum);
                            game._graphicsEnum = Content.Graphics.GraphicsEnum.EatingAnim;
                        }
                        else
                        {
                            //Saytext Method
                        }
                    }
                    break;
                case GameObjectEnum.Light:
                    UpdatePet(_pet, gameObjectEnum);
                    break;
                case GameObjectEnum.Medkit:
                    {
                        if (_pet.Health < MED_VALUE)
                        {
                            UpdatePet(_pet, gameObjectEnum);
                            //game._graphicsEnum = Content.Graphics.GraphicsEnum.Heal;
                        }
                        else
                        {
                            //Saytext Method
                        }
                    }
                    break;
                case GameObjectEnum.Soap:
                    {
                        if (_pet.Hygene < MAX_VALUE)
                        {
                            UpdatePet(_pet, gameObjectEnum);
                            //game._graphicsEnum = Content.Graphics.GraphicsEnum.Wash;
                        }
                        else
                        {
                            //Saytext Method
                        }
                    }
                    break;
                case GameObjectEnum.Watter:
                    {
                        if (_pet.Hunger < MAX_VALUE)
                        {
                            UpdatePet(_pet, gameObjectEnum);
                            game._graphicsEnum = Content.Graphics.GraphicsEnum.EatingAnim;
                        }
                        else
                        {
                            //Saytext Method
                        }
                    }
                    break;
                default:
                    game._graphicsEnum = Content.Graphics.GraphicsEnum.IdleAnim;
                    break;
            }

            _petRepository.UpdateAllPet(_pet);
            SaySomeText(game, _pet);
        }
Exemplo n.º 8
0
        private static void UpdatePet(Pet _pet, GameObjectEnum gameObjectEnum)
        {
            GameObjectRepository _gameObjectRep = new GameObjectRepository();
            GameObject _gameObject = _gameObjectRep.GetGameObject(gameObjectEnum);

            _pet.Health += _gameObject.HealthEffect;
            _pet.Hunger += _gameObject.HungerEffect;
            _pet.Hygene += _gameObject.HygeneEffect;
            _pet.Discipline += _gameObject.DisciplineEffect;
            _pet.Mood += _gameObject.MoodEffect;
            _pet.Energy += _gameObject.EnergyEffect;
        }