public void AbsorbFoods(FoodBase good) { int foodID; int num = 0x124f81; if (good is FoodEquipBase) { foodID = 0x270f; GameLogic.Hold.BattleData.AddEquip(good.GetData() as LocalSave.EquipOne); num = 0x124f83; } else { foodID = good.FoodID; AbsorbDic.TryGetValue(foodID, out num); good.GetGoods(this); if (((Time.time - this.GetAbsorbTime(foodID)) > this.mAbsorbInterval) && (good.m_Data.GetSound != 0)) { GameLogic.Hold.Sound.PlayGetGoods(good.m_Data.GetSound, base.transform.position); } } if ((Time.time - this.GetAbsorbTime(foodID)) > this.mAbsorbInterval) { base.PlayEffect(num); this.UpdateAbsorbTime(foodID); } }
static void Main(string[] args) { var burger = new Burger(); var sushi = new Sushi(); var pizza = new Pizza(); var foods = new FoodBase[] { burger, sushi, pizza }; foreach (var food in foods) { food.GetType(); food.Organic(); } //burger.GetType(); //burger.Organic(); //Console.WriteLine(); //sushi.GetType(); //sushi.Organic(); //Console.WriteLine(); //pizza.GetType(); //pizza.Organic(); //Console.WriteLine(); Console.ReadLine(); }
override public void Eat(FoodBase food) { base.Eat(food); //todo: play animator UpLevel(); }
public static FoodBase GetItem(long objNo) { TableFoodData data = Array.Find(Table, i => i.ObjNo == objNo); FoodBase item = new FoodBase(); item.Initialize(); item.ObjNo = data.ObjNo; item.FType = data.FType; item.HpRecoverPoint = data.HpRecover; item.SatRecoverPoint = data.SatRecover; item.StatusBadTarget = data.StateBad; item.StatusRecoverTarget = data.StateRecover; if (GameStateInformation.IsEnglish == false) { item.DisplayName = data.DisplayName; item.Description = data.Description; } else { item.DisplayName = data.DisplayNameEn; item.Description = data.DescriptionEn; } item.ThrowDexterity = data.ThrowDexterity; return(item); }
public void SetCurrentFood(FoodBase food) { currentFood = food; if (isLeftTeam) { UIManager.Instance.SetLeftPlayerFood(food); } else { UIManager.Instance.SetRightPlayerFood(food); } }
public void Test() { FoodFactory factory = new FoodFactory(); FoodBase f1 = factory.Create("Cheese"); FoodBase f2 = factory.Create("Cheese"); Assert.IsNotNull(f1); Assert.AreEqual <int>(f1.GetHashCode(), f2.GetHashCode()); FoodBase f3 = factory.Create("Capsicum"); Assert.AreNotEqual <int>(f1.GetHashCode(), f3.GetHashCode()); }
override public FoodBase ProduceFood() { FoodBase food = base.ProduceFood(); if (food == null) { var foodGo = GameObject.Instantiate(UIManager.Instance.foodTemplate); food = foodGo.AddComponent <Milk>(); foodListPool.Add(food); } return(food); }
public FoodBase ProduceFood() { FoodFactory factory = RandomGetFoodFactory(); if (factory == null) { return(null); } FoodBase food = factory.ProduceFood(); return(food); }
public virtual void Eat(FoodBase food) { if (food.GetType() != currentFood.GetType()) { //吃错食物,游戏结束 GameManager.Instance.ChangeGameState(GameStateEnum.End); FoodManager.Instance.CollectFood(food); return; } score += 2; GameManager.Instance.CurrentScore += 2; FoodManager.Instance.CollectFood(food); Debug.Log(this.GetType().Name + " eat " + food.foodName); }
private void OnUpdate(float delta) { if (this.bStart) { if ((this.currentFrame % 3) == 0) { if (((this.goodslist == null) || (this.currentindex >= this.goodslist.Count)) || (this.currentindex < 0)) { if (this.callback != null) { this.callback(); } this.bStart = false; return; } string str = string.Empty; switch (this.goodslist[this.currentindex].type) { case FoodType.eHP: case FoodType.eGold: case FoodType.eExp: str = this.goodslist[this.currentindex].childtype.ToString(); break; case FoodType.eEquip: { LocalSave.EquipOne data = this.goodslist[this.currentindex].data as LocalSave.EquipOne; str = "1010101"; break; } } object[] args = new object[] { "Game/Food/", str }; GameObject obj2 = GameLogic.EffectGet(Utils.GetString(args)); obj2.transform.parent = this.MapGoodsDrop; obj2.transform.position = new Vector3(this.pos.x, 0f, this.pos.z); obj2.transform.localScale = Vector3.one; FoodBase component = obj2.GetComponent <FoodBase>(); component.Init(this.goodslist[this.currentindex].data); Vector3 randomEndPosition = this.GetRandomEndPosition(this.Goldslist, this.GoldsCenter); component.SetEndPosition(this.pos, randomEndPosition); this.currentindex++; } this.currentFrame++; } }
public void OnSnakeCollision(Snake sender, object collide_with) { if (collide_with is FoodBase) { FoodBase food = collide_with as FoodBase; if (GlobalStorage.Instance.CurrentMap.FreeCellsCount > 1) { food.ReplaceOnMap(); Snake.Length++; SetPlayerPoints(Snake.Length - GlobalStorage.Instance.Default_SnakeLength); if (Snake.Length == Snake.NodePool.PoolCapacity) { GameFinished(true); } } } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { f = new FoodBase(); ft.text = foodtext[i]; i++; i = i % 5; } else if (Input.GetKeyDown(KeyCode.Q)) { f = new Salt(f); } else if (Input.GetKeyDown(KeyCode.W)) { f = new Honey(f); } ht.text = "hunger gain from food is " + f.GetHunger() + " points."; kt.text = "keep time of food is " + f.GetKeepTime() + " days."; }
public void Initialize() { Random.InitState(Time.frameCount); Map.AssociatedTilemap = AssociatedTilemap; Map.OnResize.AddListener(OnMapResize); Snake.NodePool.UseAutoGrow = false; Map.Resize(GlobalStorage.Instance.Default_MapSize); Snake.OnMapOutOfBounds.AddListener(OnSnakeMapOutOfBounds); Snake.OnCollideWithSelf.AddListener(OnSnakeCollideWithSelf); Snake.OnCollision.AddListener(OnSnakeCollision); GameParams.Initialize(); Food = new FoodBase(); Food.Tile = GlobalStorage.Instance.FoodTile; KeyboardEvents.sKeyboard_Events.Current.Handlers.AddLast(this); KeyboardEvents.sKeyboard_Events.Current.Handlers.AddLast(SnakeController); KeyboardEvents.sKeyboard_Events.Current.Handlers.AddLast(UI); UI_Leaderboard.InitData(); UI_Leaderboard.LoadFromFile(GlobalStorage.Instance.LeaderboardFile); PauseGame(); ActivateMenu(UILayerName_MainMenu, true, true); }
public Salt(FoodBase f) { seasoned = f; }
public Honey(FoodBase f) { seasoned = f; }
public void CollectFood(FoodBase food) { food.IsFinish = true; food.State = FoodState.Expire; food.SetVisible(false); }
// Start is called before the first frame update void Start() { f = new FoodBase(); ft.text = "feed me!"; }
public void SetLeftPlayerFood(FoodBase food) {
void Awake() { food = gameObject.GetComponent <FoodBase>(); }
public SeasoningBase(FoodBase f) { seasoned = f; }