private Carrot GetCarrot() { Carrot result = new Carrot(); // ... return(result); }
/** starts carrot */ void launchCarrot(float direction) { GameObject obj = GameObject.Instantiate(this.prefabCarrot); obj.transform.position = transformCarrot.position; Carrot carrot = obj.GetComponent <Carrot>(); }
private Carrot GetCarrot() { Carrot carrot = new Carrot(); Console.WriteLine("One more carrot."); return carrot; }
//加载地图 #if Game public void LoadMap(int bigLevel, int level) { bigLevelID = bigLevel; levelID = level; LoadLevelFile(LoadLevelInfoFile("Level" + bigLevel.ToString() + "_" + levelID.ToString() + ".json")); //Debug.Log("重新加载地图"+ "Level" + bigLevel.ToString() + "_" + levelID.ToString() + ".json"); monsterPathPos = new List <Vector3>(); for (int i = 0; i < monsterPath.Count; i++) { monsterPathPos.Add(gridPoints[monsterPath[i].xIndex, monsterPath[i].yIndex].transform.position); } //起始点和终止点 //monsterPath里面存储的只是一个位置,这个要先实例化出来 GameObject startPointGo = GameController.Instance.GetGameObjectResource("startPoint"); startPointGo.transform.position = monsterPathPos[0]; startPointGo.transform.SetParent(this.transform); GameObject endPointGo = GameController.Instance.GetGameObjectResource("Carrot"); //萝卜的位置,这个减去的v3是因为。。。也许有什么挡住了萝卜导致无法点击 endPointGo.transform.position = monsterPathPos[monsterPathPos.Count - 1] - new Vector3(0, 0, 1); endPointGo.transform.SetParent(this.transform); mCarrot = endPointGo.GetComponent <Carrot>(); }
/// <summary> /// Retorna o id da area dona da cenoura que voce pediu imbecil /// </summary> /// <param name="carrotId"></param> /// <returns></returns> private int AreaFromThisCarrot(int carrotId) { if (_showDebugMessages) { Debug.Log("Descobrindo a área que é dona dessa cenoura<" + carrotId + ">"); } Carrot carrotToFoundArea = GetCarrotById(carrotId); PlayerArea playerAreaFromThisCarrot = PlayerAreaList.Where(pl => pl.CarrotsList.Contains(carrotToFoundArea)).FirstOrDefault(); if (playerAreaFromThisCarrot == null) { if (_showDebugMessages) { Debug.Log("Cenoura está com algum jogador<Jogador Dono Atual:" + carrotToFoundArea.PlayerOwnerId + ">"); } return(0); } else { if (_showDebugMessages) { Debug.Log("Area dona encontrada: <" + playerAreaFromThisCarrot.Id + ">"); } return(playerAreaFromThisCarrot.Id); } }
// 加载地图 public void LoadMap(int bigLevelIDD, int levelIDD) { bigLevelID = bigLevelIDD; levelID = levelIDD; LevelInfo levelInfo = LoadLevelInfoByJson("level_" + bigLevelID + "_" + levelID + ".json"); LoadLevelData(levelInfo); // 获得怪物路点的坐标值 monsterPathPos = new List <Vector2>(); for (int i = 0; i < monsterPathGrids.Count; i++) { GridPoint tempPoint = gridPoints[monsterPathGrids[i].xIndex, monsterPathGrids[i].yIndex]; monsterPathPos.Add(tempPoint.transform.position); } // 设置怪物路径的起始点和终止点 GameObject startPointGo = GameController.Instance.GetGameObjectResource("startPoint"); startPointGo.transform.position = monsterPathPos[0]; startPointGo.transform.SetParent(transform); GameObject endPointGo = GameController.Instance.GetGameObjectResource("Carrot"); endPointGo.transform.position = monsterPathPos[monsterPathPos.Count - 1]; endPointGo.transform.SetParent(transform); // 获得carrot脚本 carrot = endPointGo.GetComponent <Carrot>(); }
private void Update() { if (currentTarget == null) { for (int radius = 1; radius <= 64; radius *= 2) { Collider[] collisions = Physics.OverlapSphere(rigidbody.transform.position, radius); foreach (Collider possibleFood in collisions) { if (possibleFood.GetComponentInChildren <Carrot>() != null) { currentTarget = possibleFood.GetComponentInChildren <Carrot>(); goto found; } } } } found: if (transform.position.y < -1000) { Destroy(this); } }
public void Chop(Mobile from) { if (from.InRange(this.GetWorldLocation(), 1)) { if (from == m_sower) { from.Direction = from.GetDirectionTo(this); double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100; if ((lumberValue > .5) && (Utility.RandomDouble() <= lumberValue)) { Carrot fruit = new Carrot(Utility.Random(m_yield + 2)); from.AddToBackpack(fruit); } this.Delete(); from.SendMessage("You chop the plant up"); } else { from.SendMessage("You do not own this plant !!!"); } } else { from.SendLocalizedMessage(500446); } }
public void Cook() { Bowl bowl = GetBowl(); Potato potato = GetPotato(); Peel(potato); Cut(potato); bowl.Add(potato); Carrot carrot = GetCarrot(); Peel(carrot); Cut(carrot); bowl.Add(carrot); //OR *depends on the specific case* Potato potato = GetPotato(); Peel(potato); Cut(potato); Carrot carrot = GetCarrot(); Peel(carrot); Cut(carrot); Bowl bowl = GetBowl(); bowl.Add(potato); bowl.Add(carrot); }
private Carrot GetCarrot() { Carrot result = new Carrot(); // ... return result; }
IEnumerator attackLater() { yield return(new WaitForSeconds(0.1f)); Vector3 rabbit_pos = HeroRabbit.current.transform.position; Vector3 orc_pos = this.transform.position; if (SoundManager.manager.isSoundOn()) { soundSource.Play(); } this.orcAnimator.SetTrigger("attack"); GameObject carrot = GameObject.Instantiate(weapon); carrot.transform.position = this.transform.position + Vector3.up * 0.5f; Carrot obj = carrot.GetComponent <Carrot> (); if (orc_pos.x < rabbit_pos.x) { obj.launch(1); } else if (orc_pos.x > rabbit_pos.x) { obj.launch(-1); } }
void launchCarrot() { if (this.health > 0) { Vector3 my_pos = this.transform.position; Vector3 rabit_pos = HeroRabbit.lastRabit.transform.position; if (Mathf.Abs(my_pos.x - rabit_pos.x) <= 7.0f) { if (Time.time - this.last_carrot > 4.0f && !HeroRabbit.lastRabit.isDead()) { this.last_carrot = Time.time; GameObject obj = GameObject.Instantiate(this.carrot); obj.transform.position = my_pos + Vector3.up * 0.5f; Carrot carrot = obj.GetComponent <Carrot>(); if (rabit_pos.x < my_pos.x) { carrot.launch(-1); } else { carrot.launch(1); } } } } if (SoundManager.Instance.isSoundOn()) { attackSource.Play(); } }
void launchCarrot() { Animator animator = GetComponent <Animator> (); Vector3 my_pos = this.transform.position; Vector3 rabit_pos = HeroRabit.lastRabit.transform.position; if (Time.time - this.lastCarrot > time) { if (SoundManager.Instance.isSoundOn()) { attackSource.Play(); } animator.SetTrigger("attack"); this.lastCarrot = Time.time; GameObject gameObject = GameObject.Instantiate(this.carrot); gameObject.transform.position = my_pos + Vector3.up * 0.5f; Carrot carrot = gameObject.GetComponent <Carrot> (); if (rabit_pos.x < my_pos.x) { carrot.launch(-1); } else { carrot.launch(1); } } }
private void DrawCarrot(Vector2Int chunkCoord, InfiniteChunks.Chunk chunk, GameObject asteroid, int asteroidSize) { GameObject carrot = carrotPool.GetFromPool(0); if (carrot == null) { return; } Vector2 dir = Random.insideUnitCircle.normalized * (asteroidSize + 1); carrot.transform.position = asteroid.transform.position + asteroid.transform.TransformDirection(dir); Vector3 targetRotateDir = asteroid.transform.position - carrot.transform.position; float angle = (Mathf.Atan2(targetRotateDir.y, targetRotateDir.x) * Mathf.Rad2Deg) - 90f; carrot.transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward); FixedJoint2D joint = carrot.GetComponent <FixedJoint2D>(); joint.connectedBody = asteroid.GetComponent <Rigidbody2D>(); Carrot script = carrot.GetComponent <Carrot>(); script.SetPickupCallback(CarrotPickup, chunkCoord); carrot.SetActive(true); chunk.AddCarrot(carrot); }
IEnumerator launchCarrot() { Vector3 my_pos = this.transform.position; Vector3 rabit_pos = HeroRabit.lastRabit.transform.position; if (Mathf.Abs(rabit_pos.x - my_pos.x) < radius) { if (Time.time - this.lastCarrot > time) { this.lastCarrot = Time.time; if (sound) { attackSource.Play(); } animator.SetTrigger("attackRabit"); yield return(new WaitForSeconds(0.2f)); GameObject obj = GameObject.Instantiate(this.carrot); obj.transform.position = my_pos + Vector3.up * 0.5f; //Запускаємо в рух Carrot carrot = obj.GetComponent <Carrot> (); if (rabit_pos.x < my_pos.x) { carrot.launch(-1); } else { carrot.launch(1); } } } }
void CreateCarrot() { Vector3 position = new Vector3(Random.Range(-size, size), 0, Random.Range(-size, size)); Carrot carrot = AnimalFactory.Instance.CreateCarrot(); carrot.transform.parent = transform; carrot.transform.localPosition = position; }
public Carrot CreateCarrot() { Carrot carrot = GameObject.Instantiate <Carrot>(carrotPrefab); carrot.transform.eulerAngles = new Vector3(0, Random.Range(0f, 360f), 0); AnimalMap.animalMap.carrots.Add(carrot); return(carrot); }
public override Item GetCropObject() { Carrot carrot = new Carrot(); carrot.ItemID = Utility.Random( 3191, 2 ); return carrot; }
private void LaunchCarrot(float direction) { GameObject obj = GameObject.Instantiate(this.prefabCarrot, transform.position + new Vector3(0, 0.5f, 0), transform.rotation); Carrot carrot = obj.GetComponent <Carrot>(); carrot.Launch(direction); last_carrot = Time.time; }
public override Item GetCropObject() { Carrot carrot = new Carrot(); carrot.ItemID = Utility.Random(3191, 2); return(carrot); }
public IVegetable GetCarrot() { var carrot = new Carrot(); this.speachLog.Say("Carrot Nom Nom!"); return(carrot); }
public IVegetable GetCarrot() { var carrot = new Carrot(); this.speachLogger.Say("Alright, here we have a carrot!"); return(carrot); }
internal Carrot GetCarrot() { var carrot = new Carrot(); Peel(carrot); Cut(carrot); return(carrot); }
void launchCarrot(float direction) { GameObject obj = GameObject.Instantiate(this.prefabCarrot); obj.transform.position = this.transform.position + (new Vector3(0f, 1f, 0f)); Carrot carrot = obj.GetComponent <Carrot> (); carrot.launch(direction); }
void LaunchCarrot(float direction) { GameObject obj = GameObject.Instantiate(this.PrefabCarrot); obj.transform.position = new Vector3(this.transform.position.x, this.transform.position.y + 0.7f, .0f); Carrot carrot = obj.GetComponent <Carrot>(); carrot.Launch(direction); }
internal Carrot GetCarrot() { var carrot = new Carrot(); Peel(carrot); Cut(carrot); return carrot; }
private void ThrowCarrot() { timeLeft = ReloadTime; animOrc.Play("BrownOrc_Attack"); Carrot newCarrot = Instantiate(CarrotGameObject.gameObject).GetComponent <Carrot>(); newCarrot.transform.position = transform.position + new Vector3(0, 1, 0); newCarrot.Speed = CarrotSpeed; newCarrot.Direction = !sr.flipX; }
void launchCarrot() { //Створюємо копію Prefab GameObject obj = GameObject.Instantiate(this.prefabCarrot); //Розміщуємо в просторі obj.transform.position = this.transform.position; //Запускаємо в рух Carrot carrot = obj.GetComponent <Carrot>(); }
public void Cook() { Bowl bowl; Potato potato = GetPotato(); Carrot carrot = GetCarrot(); bowl = GetBowl(); Peel(carrot); bowl.Add(carrot); }
private void GettingAwayFromCarrot() { if (_targetToPick != null) { _targetToPick.GetComponent <CarrotBehaviour>().OnTargetExit(); _targetToPick = null; IsTouchingCarrot = false; _playerConfig.ActionButtonHandler.CheckButtonToShow(); } }
internal void CreateCarrot(Vector2 position, bool instantly = false) { var sprite = new Sprite(new TextureRegion2D(ContentLoader.Instance.Tileset, TileSize * 7, TileSize * 0, TileSize, TileSize)) { OriginNormalized = Vector2.Zero, Depth = 0.6f, }; var carrot = new Carrot(position, sprite); AddActor(carrot, instantly); }
void LaunchCarrot(float direction) { animator.SetTrigger("attack"); last_carrot = Time.time; GameObject obj = GameObject.Instantiate(this.prefabCarrot); obj.transform.position = this.transform.position + new Vector3(0, 1, 0);; Carrot carrot = obj.GetComponent <Carrot> (); carrot.launch(direction); }
private void Start() { Energyimg = Energy.GetComponent <SpriteRenderer>().sprite; Carrotimg = Carrot.GetComponent <SpriteRenderer>().sprite; Pickelimg = Pickel.GetComponent <SpriteRenderer>().sprite; Taimatuimg = Taimatu.GetComponent <SpriteRenderer>().sprite; Sekibanimg = Sekiban.GetComponent <SpriteRenderer>().sprite; ActionbtnA.SetActive(false); ActionbtnB.SetActive(false); LadderSwitch = false; Item0sprite.GetComponent <Image>().sprite = nullimg; Item1sprite.GetComponent <Image>().sprite = nullimg; }
void AttackWithCarrot() { attackTime = coolDownTime; Carrot carr = Instantiate(carrot.gameObject).GetComponent <Carrot> (); carr.transform.position = transform.position + new Vector3(0, 0.5f, 0); //animator.SetTrigger("kick"); carr.speed = 0.1f; carr.lifeDuration = 5f; carr.direction = value; }
public void Main() { Potato potato = new Potato(); Carrot carrot = new Carrot(); Peel(potato); Peel(carrot); Cut(potato); Cut(carrot); Bowl bowl = new Bowl(); bowl.Add(carrot); bowl.Add(potato); }
public void Cook(Vegetable vegetable) { Potato potato = new Potato(); potato.Peel(); potato.Cut(); Carrot carrot = new Carrot(); carrot.Peel(); carrot.Cut(); Bowl bowl = new Bowl(); bowl.Add(potato); bowl.Add(carrot); }
public void Cook() { Potato potato = new Potato(); Carrot carrot = new Carrot(); Bowl bowl = new Bowl(); Potato.Peel(potato); Carrot.Peel(carrot); this.Cut(potato); this.Cut(carrot); bowl.AddVegetable(potato); bowl.AddVegetable(carrot); }
public void CookTest() { // Base code refactored functionally goes below Potato potato = new Potato(); Carrot carrot = new Carrot(); Bowl bowl = new Bowl(); potato.Peel(); carrot.Peel(); potato.Cut(); carrot.Cut(); bowl.Add(carrot); bowl.Add(potato); // task2 - Potato COOKING! - included in the base code this.Cook(bowl.Ingredients); }
static void Main(string[] args) { Potato firstPotato = new Potato(); Carrot firstCarrot = new Carrot(); Console.WriteLine(firstPotato.ToString()); Console.WriteLine(firstCarrot.ToString()); //Bowl bowl = new Bowl(); //bowl.Ingredients.Add(firstPotato); //bowl.Ingredients.Add(firstCarrot); //foreach (var item in bowl.Ingredients) //{ // Console.WriteLine(item.GetType().Name); //} //Console.WriteLine(bowl.ToString()); Chef chef = new Chef(); var meal = chef.Cook(); Console.WriteLine(meal); }
private void InitContents( FruitType type ) { Food item = null; byte count = (byte)Utility.RandomMinMax( 10, 30 ); for( byte i = 0; i < count; i++ ) { switch( type ) { default: case FruitType.Apples: item = new Apple(); break; case FruitType.Bananas: item = new Banana(); break; case FruitType.Bread: item = new BreadLoaf(); break; case FruitType.Gourds: item = new Gourd(); break; case FruitType.Grapes: item = new Grapes(); break; case FruitType.Lemons: item = new Lemon(); break; case FruitType.Tomatoes: item = new Tomato(); break; case FruitType.Vegetables1: case FruitType.Vegetables2: case FruitType.Vegetables3: { switch( Utility.Random( 4 ) ) { case 0: item = new Carrot(); break; case 1: item = new Onion(); break; case 2: item = new Pumpkin(); break; case 3: item = new Gourd(); break; } break; } } if( item != null ) DropItem( item ); } }
public Carrot(Carrot carrot) : base(carrot) { }
public CachedRequest CacheRequest(Carrot.ServiceType serviceType, string endpoint, Dictionary<string, object> parameters) { CachedRequest ret = new CachedRequest(); ret.ServiceType = serviceType; ret.Endpoint = endpoint; ret.Parameters = parameters; ret.RequestDate = (long)((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000); ret.RequestId = System.Guid.NewGuid().ToString(); ret.Retries = 0; #if CACHE_ENABLED IntPtr sqlStatement = IntPtr.Zero; string sql = string.Format(kCacheInsertSQL, ret.ServiceType, ret.Endpoint, Json.Serialize(ret.Parameters), ret.RequestId, ret.RequestDate, ret.Retries); lock(this) { if(sqlite3_prepare_v2(mDBPtr, sql, -1, out sqlStatement, IntPtr.Zero) == SQLITE_OK) { if(sqlite3_step(sqlStatement) == SQLITE_DONE) { ret.Cache = this; ret.CacheId = sqlite3_last_insert_rowid(mDBPtr); } else { Debug.Log("Failed to write request to Carrot cache. Error: " + sqlite3_errmsg(mDBPtr)); } } else { Debug.Log("Failed to write request to Carrot cache. Error: " + sqlite3_errmsg(mDBPtr)); } } sqlite3_finalize(sqlStatement); #else lock(this) { ret.Cache = this; mCachedRequests.Add(ret); } #endif return ret; }
public List<CachedRequest> RequestsInCache(Carrot.AuthStatus authStatus) { List<CachedRequest> cachedRequests = new List<CachedRequest>(); #if CACHE_ENABLED IntPtr sqlStatement = IntPtr.Zero; lock(this) { string sql = string.Format(kCacheReadSQL, (int)authStatus); if(sqlite3_prepare_v2(mDBPtr, sql, -1, out sqlStatement, IntPtr.Zero) == SQLITE_OK) { while(sqlite3_step(sqlStatement) == SQLITE_ROW) { CachedRequest request = new CachedRequest(); request.CacheId = sqlite3_column_int64(sqlStatement, 0); request.ServiceType = (Carrot.ServiceType)sqlite3_column_int(sqlStatement, 1); request.Endpoint = sqlite3_column_text(sqlStatement, 2); request.Parameters = Json.Deserialize(sqlite3_column_text(sqlStatement, 3)) as Dictionary<string, object>; request.RequestId = sqlite3_column_text(sqlStatement, 4); request.RequestDate = (long)sqlite3_column_double(sqlStatement, 5); request.Retries = sqlite3_column_int(sqlStatement, 6); request.Cache = this; cachedRequests.Add(request); } } else { Debug.Log("Failed to load requests from Carrot cache. Error: " + sqlite3_errmsg(mDBPtr)); } } sqlite3_finalize(sqlStatement); #else lock(this) { foreach(CarrotCache.CachedRequest crequest in mCachedRequests) { if((int)crequest.ServiceType <= (int)authStatus) { //Debug.Log("Somethingsomething: " + crequest); cachedRequests.Add(crequest); } } } #endif return cachedRequests; }
private Carrot GetCarrot() { Carrot result = new Carrot(); // some code return result; }
private Carrot GetCarrot() { Carrot newCarrot = new Carrot(10, 5); return newCarrot; }
internal void Add(Carrot carrot) { throw new NotImplementedException(); }
private void Cut(Carrot carrot) { }
private void Peel(Carrot carrot) { }
public void Add(Carrot carrot) { }
private Carrot GetCarrot() { var carrot = new Carrot(); return carrot; }
private void Peel(Carrot carrot) { throw new NotImplementedException(); }