// 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 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); }