// Use this for initialization void Start() { thisRigiBody2D = this.GetComponent <Rigidbody2D> (); sMB = soundManagerGetter.getManager(); sVMS = staticValueManagerGetter.getManager(); grantExpChara = new HashSet <int>(); thisEnemyStat = new typeEnemyStatus(_defaultLevel, _defaultEnemyType); this.createHPBar(); //影の作成 //重いので一時的に停止 if (_enemyShadow != null && sVMS.getRenderingShadowFlag()) { //影がセットされているときは表示 GameObject tmpEnemyShadow = new GameObject("enemyShadow"); tmpEnemyShadow.AddComponent <SpriteRenderer> (); tmpEnemyShadow.GetComponent <SpriteRenderer> ().sprite = _enemyShadow; tmpEnemyShadow.GetComponent <SpriteRenderer> ().color = new Color(1f, 1f, 1f, 0.3f); tmpEnemyShadow.transform.parent = this.transform; tmpEnemyShadow.transform.localPosition = Vector3.zero; textureVector ttv = new textureVector(this.gameObject); Vector3 tmpThisWidth = ttv.getBottomOffset_ForCenterPivot(0f, 0.05f, animeScalingFlag); tmpEnemyShadow.transform.localPosition += tmpThisWidth; //影画像は128 float tmpScale = ttv.getWidth(animeScalingFlag) / 1.28f; tmpEnemyShadow.transform.localScale = new Vector3(tmpScale, tmpScale, 1f); } gmS = GameManagerGetter.getGameManager(); }
public void setFindFlag(bool argsBool, bool leftFlag) { GameObject exclamationPrefab = Resources.Load("Prefabs/charaBase/exclamation") as GameObject; charaFindFlag = argsBool; GameObject tmpGO = Instantiate(exclamationPrefab) as GameObject; tmpGO.transform.position = this.transform.position; textureVector ttv = new textureVector(this.gameObject); tmpGO.transform.position += new Vector3(0f, ttv.getHeight(animeScalingFlag), 0f); tmpGO.transform.parent = this.transform; Vector3 tmpV3 = this.transform.Find("anime").transform.localScale; if (leftFlag == true && tmpV3.x < 0) { this.transform.Find("anime").transform.localScale = new Vector3(tmpV3.x * -1f, tmpV3.y, tmpV3.z); //Debug.Log (leftFlag); } if (leftFlag == false && tmpV3.x > 0) { this.transform.Find("anime").transform.localScale = new Vector3(tmpV3.x * -1f, tmpV3.y, tmpV3.z); //Debug.Log (leftFlag); } }
IEnumerator iconDelay() { yield return(new WaitForSeconds(0.5f)); if (thisAnimeObj.transform.localScale.x > 0) { thisAnimeObj.transform.localScale += new Vector3(0.1f, 0.1f, 0f); } else { thisAnimeObj.transform.localScale += new Vector3(-0.1f, 0.1f, 0f); } GameObject exclamationPrefab = Resources.Load("Prefabs/charaBase/enemyPowerUpIcon") as GameObject; GameObject tmpGO = Instantiate(exclamationPrefab) as GameObject; tmpGO.transform.position = this.transform.position; textureVector ttv = new textureVector(this.gameObject); tmpGO.transform.position += new Vector3(0f, ttv.getHeight(true), 0f); tmpGO.transform.parent = this.transform; thisBase.createHPBar(); }
public void setDefaultLevel(float argsLevel) { _defaultLevel = argsLevel; thisEnemyStat = new typeEnemyStatus(argsLevel, _defaultEnemyType); textureVector ttv = new textureVector(this.gameObject); hpBar.setMaxBarLength_argsWidth(ttv.getWidth(animeScalingFlag), thisEnemyStat.maxHP); }
// Use this for initialization void Start() { thisRigiBody = this.GetComponent <Rigidbody2D> (); sMB = soundManagerGetter.getManager(); gmScript = GameObject.Find("GameManager").GetComponentInChildren <GameManagerScript>(); cmrTracker = GameObject.Find("CameraTracker").GetComponentInChildren <cameraTrackerScript> (); thisAnimeGO = this.transform.Find("charaAnime").gameObject; thisAnimeter = thisAnimeGO.gameObject.GetComponentInChildren <Animator>(); thisAudio = this.gameObject.GetComponentInChildren <AudioSource>(); thisAtkCircle = this.transform.Find("atkCircle").gameObject.GetComponentInChildren <SpriteRenderer> (); thisAttackErea = this.transform.Find("AttackErea").gameObject; //this.gameObject.Find("") //ステータスアイコン表示のオブジェクトは起動時に作成 charaStatusIconCtrlS = Instantiate(_charaStatusIconCtrler).GetComponent <charaStatusIconCtrl>(); charaStatusIconCtrlS.transform.parent = this.transform; this.setMode(characterMode.Attack); this.createHPBar(); staticValueManagerS sVMS = staticValueManagerGetter.getManager(); //影の作成 //重いので一時的に停止 if (_charaShadow != null && sVMS.getRenderingShadowFlag()) { //影がセットされているときは表示 GameObject tmpEnemyShadow = new GameObject("charaShadow"); tmpEnemyShadow.AddComponent <SpriteRenderer> (); tmpEnemyShadow.GetComponent <SpriteRenderer> ().sprite = _charaShadow; tmpEnemyShadow.GetComponent <SpriteRenderer> ().color = new Color(1f, 1f, 1f, 0.3f); tmpEnemyShadow.transform.parent = this.transform; tmpEnemyShadow.transform.localPosition = Vector3.zero; textureVector ttv = new textureVector(this.gameObject); Vector3 tmpThisWidth = ttv.getBottomOffset_ForCenterPivot(0f, 0.05f, false); tmpEnemyShadow.transform.localPosition += tmpThisWidth; //影画像は128 float tmpScale = ttv.getWidth(false) / 1.28f; tmpEnemyShadow.transform.localScale = new Vector3(tmpScale, tmpScale, 1f); } StartCoroutine(mainLoop()); StartCoroutine(calcCoolTimeLoop()); }
public void createHPBar() { //HP Barの作成 if (hpBar != null) { Destroy(hpBar.gameObject); } GameObject tmpHpbarGO = Instantiate(_HPBar) as GameObject; tmpHpbarGO.transform.parent = this.transform; tmpHpbarGO.transform.localPosition = Vector3.zero; //位置補正 textureVector ttv = new textureVector(this.gameObject); Vector3 tmpV = ttv.getBottomOffset_ForCenterPivot(0, -0.05f, animeScalingFlag); tmpHpbarGO.transform.localPosition += tmpV; hpBar = tmpHpbarGO.GetComponent <enemyHPBarScript>(); hpBar.setMaxBarLength_argsWidth(ttv.getWidth(animeScalingFlag), thisEnemyStat.maxHP); }