override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { fish = animator.gameObject; fishManager = fish.GetComponent <FishManager>(); waterlevel = fishManager.waterlevel; _defaultTurnDirection = fishManager.defaultTurnDirection; }
public void Activate() { FM = FindObjectOfType <FishManager>(); LowerPoint.transform.localPosition = new Vector3(0, FM.height / 2, 0); UpperPoint.transform.localPosition = new Vector3(FM.tankRadius, FM.height + FM.waterOffset + 1, 0); UpdateCameraZoom(); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // fish = animator.gameObject; fishManager = fish.GetComponent <FishManager>(); direction = fish.transform.forward; }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { fish = animator.gameObject; fishManager = fish.GetComponent <FishManager>(); direction = fish.transform.forward; animator.SetBool("obstacleIsClose", false); }
void Start() { //find the opening to the container opening = GameObject.Find("ToolFoodContainer/Opening"); fishManager = FishManager.instance; }
void Awake() { _transform = GetComponent <Transform> (); _rigidbody = GetComponent <Rigidbody> (); if (_rigidbody == null) // if Rigidbody is missing { Debug.LogError("Rigidbody2D component missing from this gameobject"); } _animator = GetComponent <Animator>(); if (_animator == null) // if Animator is missing { Debug.LogError("Animator component missing from this gameobject"); } _audio = GetComponent <AudioSource>(); if (_audio == null) { // if AudioSource is missing Debug.LogWarning("AudioSource component missing from this gameobject. Adding one."); //let's just add the AudioSource component dynamically _audio = gameObject.AddComponent <AudioSource>(); } _moveTime = 0f; _moving = true; if (taskNo == 1) { dishManager = GameObject.FindGameObjectWithTag(managerTag).GetComponent <DishManager>(); } else if (taskNo == 2) { fishManager = GameObject.FindGameObjectWithTag(managerTag).GetComponent <FishManager>(); } granyAController = GameObject.Find("GranyA").GetComponent <GranyAController>(); }
void Start() { //find the fish manager fishManager = FishManager.instance; Invoke("SpawnFish", spawnTime); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { fish = animator.gameObject; fishManager = fish.GetComponent <FishManager>(); _cumulativeDragAmount = 0.0f; //fish.GetComponent<FishAni> ().cumulativeDragAmount = 0.0f; }
// Use this for initialization void Start() { FM = FMO.GetComponent <FishManager>(); timeleft = 120f; NoTimeO.gameObject.SetActive(false); }
// Use this for initialization void Start() { // instantiate level water = Instantiate(waterPrefab, Vector3.zero, Quaternion.identity); tankInner = Instantiate(tankInnerPrefab, Vector3.zero, Quaternion.identity); tankOutter = Instantiate(tankOutterPrefab, Vector3.zero, Quaternion.identity); tankTop = Instantiate(tankTopPrefab, Vector3.zero, Quaternion.identity); floor = Instantiate(floorPrefab, new Vector3(0f, 1f, 0f), Quaternion.identity); floor.transform.localScale = new Vector3(tankRadius / 2f, 1, tankRadius / 2f); fogTrigger = Instantiate(fogTriggerPrefab, Vector3.zero, Quaternion.identity); for (int i = 0; i < coralCount; i++) { Instantiate(coral1Prefab, new Vector3(Random.Range(-1f, 1f) * tankRadius, 1f, Random.Range(-1f, 1f) * tankRadius), Quaternion.identity); } FishManager FM = fishManager.GetComponent <FishManager>(); FM.tankRadius = tankRadius; FM.height = tankHeight; FM.spawnRadius = tankRadius * fishSpawnCutoff; FM.waterOffset = waterOffset; // delete water to fix texture bug Destroy(water); }
// Init private void Start() { fishManager = GameObject.FindGameObjectWithTag("Managers").GetComponent <FishManager>(); cameraScript = Camera.main.GetComponent <CameraScript>(); soundPlayer = GameObject.FindGameObjectWithTag("Managers").GetComponent <SoundPlayer>(); onTitleScreen = true; }
public void TestOneFish() { float hBound = 120; float yBottom = -70; float yUp = 70; int[] temp = new int[2] { -1, 1 }; int flag = temp[Random.Range(0, 2)]; float speed = Random.Range(40, 70); int pathid = Random.Range(0, 5); int[] temp1 = new int[10] { 0, 0, 0, 0, 0, 2, 0, 0, 0, 1 }; int fishid = temp1[Random.Range(0, 10)]; if (fishid == 1) { speed = 30; } if (fishid == 2) { speed = 20; pathid = 0; } Vector3 headPosition = new Vector3(hBound * flag, Random.Range(yBottom + 20, yUp - 20), Random.Range(96, 96 + 20)); Vector3 bornEulerAngles = new Vector3(Random.Range(-20, 20), -Random.Range(80, 100) * flag, 0); FishManager.GetInstance().CreateFish(fishid, headPosition, bornEulerAngles, pathid, speed, 0); }
public void OnClickedIsland() { FishManager.GetInstance().Initialize(); FishData.GetInstance().GameState = GameState.MainLoop; gameObject.SetActive(false); UIManager.GetInstance().Show("Debug"); }
private void Awake() { if (instance == null) { instance = this; } fishInWaterList = new List <Fish>(); }
/// <summary> /// 水槽インスタンスの取得と、魚管理クラスの初期化をしています。 /// </summary> private void Awake( ) { GameObject water_pot = GameObject.Find("WaterPot"); Assert.IsNotNull(water_pot); _water = water_pot.transform.FindChild("Water").gameObject; _fishManager = new FishManager(_water); }
public static FishManager getInstance() { if (mInstance == null) { mInstance = new FishManager(); } return(mInstance); }
void checkDeath() { if (health <= 0) { FishManager.removeFish(gameObject); ai.changeState(FishAI.states.dead); } }
private void GetManagers() { // get all managers component FloatManager = GetComponent <FloatManager>(); FishManager = GetComponent <FishManager>(); ProgressBarManager = GetComponent <ProgressBarManager>(); FishermanManager = GetComponent <FishermanManager>(); WaterManager = GetComponent <WaterManager>(); }
void Update() { if (fm == null) { fm = GameObject.Find("FishManager(Clone)").GetComponent <FishManager>(); } count = fm.FishCount(); }
// Init private void Awake() { GameObject managers = GameObject.FindGameObjectWithTag("Managers"); stateManager = StateManager.Instance; fishManager = managers.GetComponent <FishManager>(); cameraScript = Camera.main.GetComponent <CameraScript>(); soundPlayer = managers.GetComponent <SoundPlayer>(); }
private void Awake() { if (instance == null) //if not, set instance to this instance = this; fishPrefab = Resources.Load("fish 1") as GameObject; }
// Start is called before the first frame update void Start() { IsAlive = true; FishName = NewName(); if (rigidBody == null) { rigidBody = this.GetComponent <Rigidbody>(); } if (tankBoundary == null) { tankBoundary = GetComponent <TankBoundary>(); } if (tankBoundary == null) { tankBoundary = GetComponentInParent <TankBoundary>(); } if (target == null) { target = this.transform.Find("Target")?.gameObject; } if (target == null) { target = this.gameObject; } if (colliders == null) { colliders = this.GetComponentsInChildren <Collider>().Where(c => c.enabled).ToArray(); } if (fishManager == null) { fishManager = FindObjectOfType <FishManager>(); } if (fishManager != null) { fishManager.fish.Add(this); } if (feeder == null) { feeder = FindObjectOfType <FoodFeeder>(); } if (position != null) { this.transform.position = position.Position; this.transform.rotation = position.Rotation; } }
// Use this for initialization void Start() { fishManager = GameObject.Find("FishManager").GetComponent <FishManager>(); startpos = toDrag.transform.position; for (int i = 0; i < toDragC.Length; i++) { startPosC [i] = toDragC [i].transform.position; } //fishManager.GetComponent<TraceDrag> ().draggedObj = toDrag; }
void Start() { //locate the fish manager fishManager = FishManager.instance; myHyper = GetComponent <HyperObject>(); _cachedRigidbody = GetComponent <Rigidbody>(); Invoke("LifeEnd", lifeTime); }
private bool twisting; // a twist gesture is happening (don't allow pinch) void Start() { animator = GO.GetComponent <Animator>(); rb = GO.GetComponent <Rigidbody>(); fishManager = GO.GetComponent <FishManager>(); followCamera = mainCam.GetComponent <FollowCamera>(); _waterlevel = fishManager.waterlevel; _cumulativeDragAmount = fishManager.cumulativeDragAmount; camY = mainCam.transform.localPosition.y; twisting = false; }
void Awake() { //declare as singleton if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
// Update is called once per frame void Start() { if (gameObject.tag == "Inside") { inside = true; } else { inside = false; } fm = GetComponentInParent <FishManager>(); }
public void InitFish(int FishID) { var fishManager = FishManager.GetInstance(); for (int i = 0; i < Trans.Count; i++) { var fish = fishManager.CreatFishByID(FishID); fish.transform.position = Trans[i].position; fish.transform.rotation = Trans[i].rotation; fish.transform.SetParent(gameObject.transform); Fishes.Add(fish); } }
// Update is called once per frame void Update() { float dt = Time.deltaTime; UIManager.GetInstance().Update(dt); UICommandSystem.GetInstance().Update(dt); if (FishData.GetInstance().GameState == GameState.MainLoop) { TimeManager.GetInstance().Update(dt); EventManager.GetInstance().Update(dt); FishManager.GetInstance().Update(dt); } }
void Start() { //locate the fish manager fishManager = FishManager.instance; //set the wander location up to get a random point once the behavior starts wanderLoc = _cachedTransform.position; //start the feed cycles with the first one effected by the offset InvokeRepeating("FeedCycle", Random.Range(feedCycle - offset, feedCycle + offset), feedCycle); //pick a random size ChangeSize((Size)Random.Range(0, 3)); }
public void TestFishSeason() { FishSeason season = SeasonConfigManager.GetInstance().GetSeason(Random.Range(0, 3)); if (season == null) { return; } foreach (OneWave wave in season.waves) { foreach (WaveFish fish in wave.fishes) { FishManager.GetInstance().CreateFish(fish.fkid, fish.p, wave.ea, wave.pathid, wave.speed, -fish.p.x / 20.0f); } } }
public void Setup() { fManager = FishManager.FishM; Debug.Log("-----------------"); Debug.Log ("Fish number is " + fishNumber); Debug.Log ("fManager.caughtFish.count" + fManager.caughtFish.Count); Debug.Log("-----------------"); if (fManager) { Debug.Log("fmanager OK"); } else { Debug.Log("fmanager FAILED!!"); } if (fManager.caughtFish.Count >= fishNumber) { Fish fish = fManager.caughtFish [fishNumber-1]; string fishIconPath = "Prefabs/Fish/Icons/" + fish.getIcon (); string stringToLoad = fishIconPath.Substring (0, fishIconPath.Length - 1); Texture2D tex = Resources.Load<Texture2D> (stringToLoad); if (tex != null) fishIcon.sprite = Sprite.Create (tex, new Rect (0, 0, tex.width, tex.height), new Vector2 (0.5f, 0.5f)); else {Debug.Log ("Error loading fish icon: " + fish.getIcon ()); fishIcon.sprite = maguro; } fishNameTxt.text = fish.getName (); fishWeightTxt.text = fish.getWeight () + " "; distance = fish.getDistance(); maxWeight = fish.getMaxW (); weight = fish.getWeight (); rarity = fish.getRarity(); //Score for this fish gradeScore = weight / maxWeight; Debug.Log ("Fish Grade is" + gradeScore); score = (rarity+ (rarity * (gradeScore))) + ((distance/70)*100); if (gradeScore <= 0.30f) { Debug.Log ("GRADE C"); string gIcon = "Prefabs/Fish/GradeIcons/GradeC"; Texture2D tex2 = Resources.Load<Texture2D> (gIcon); if (tex2 != null) gradeIcon.sprite = Sprite.Create (tex2, new Rect (0, 0, tex2.width, tex2.height), new Vector2 (0.5f, 0.5f)); else Debug.Log ("Error loading fish icon: C grade"); } else if (gradeScore > 0.30f && gradeScore <= 0.90f) { Debug.Log ("GRADE B"); string gIcon = "Prefabs/Fish/GradeIcons/GradeB"; Texture2D tex2 = Resources.Load<Texture2D> (gIcon); if (tex2 != null) gradeIcon.sprite = Sprite.Create (tex2, new Rect (0, 0, tex2.width, tex2.height), new Vector2 (0.5f, 0.5f)); else Debug.Log ("Error loading fish icon: Grade B"); } else if (gradeScore > 0.90f) { Debug.Log ("GRADE C"); string gIcon = "Prefabs/Fish/GradeIcons/GradeA"; Texture2D tex2 = Resources.Load<Texture2D> (gIcon); if (tex2 != null) gradeIcon.sprite = Sprite.Create (tex2, new Rect (0, 0, tex2.width, tex2.height), new Vector2 (0.5f, 0.5f)); else Debug.Log ("Error loading fish icon: Grade A"); } } else { /* for (int i = 0; i < transform.childCount; ++i) { transform.GetChild(i).gameObject.SetActive(false); }*/ fishIcon.sprite = failSprite; gradeIcon.sprite = batsuSprite; fishNameTxt.text = "No Catch!"; fishWeightTxt.text = "0"; distance = 0; maxWeight = 0; weight = 0; rarity = 0; } }
void Awake() { fManager = FishManager.FishM; }
void Awake() { if (FishM == null) { FishM = this; } }
// Use this for initialization void Start() { // nView = GetComponent<NetworkView>(); fishM = FishManager.fishmanager; }
void Awake() { m_MyTransform = this.gameObject.transform; m_FishManager = new FishManager(); GameObject rendererObject = GameObject.Find("VoronoiMesh"); m_MeshFilter = rendererObject.GetComponent<MeshFilter>(); float z = (m_MeshFilter.transform.position - Camera.main.transform.position).magnitude; Vector3 bottomLeft = Camera.main.ViewportToWorldPoint (new Vector3 (0, 0, z)); Vector3 topRight = Camera.main.ViewportToWorldPoint (new Vector3 (1, 1, z)); m_MeshRect = new Rect (bottomLeft.x, bottomLeft.z, topRight.x - bottomLeft.x, topRight.z - bottomLeft.z); }
void Start() { fManager = FishManager.FishM; // Setup(); //Setup(); }
void Awake() { if (fishmanager == null) fishmanager = this; }