private IEnumerator DeathStart() { gameObject.layer = Layers.Death; Action.Death(); if (agent) { agent.Stop(); agent.velocity *= 0; } if (anim) { Sensor = null; anim.Play("Death"); yield return(null); yield return(StartCoroutine(WaitAnimationEnd("Death"))); } //アイテムが出るかの確立 ItemDrop(); //EnemySpawnリストから消す ListDestroy(); //自身のオブジェクトを消す Destroy(gameObject); yield break; }
private IEnumerator ShotAction(GameObject target) { NowCoroutine = ShotAction(target); Sensor = PlayerSensor.GetComponent <PlayerSensor>(); //targetが感知範囲から出た時にShootingがのtreuときfalseにしてwhile抜ける while (Sensor.GetPL_Search() && GetShooting()) { // if (target.GetComponent<Character>().HP <= 0) //{ break; } //弾を生成する GameObject Bullets = Instantiate(Bullet, transform.position, Quaternion.identity); //弾に初速を与える Bullets.GetComponent <Rigidbody>().AddForce(transform.forward * ShotSpeed, ForceMode.Impulse); Bullets.AddComponent <AttackArea>(); Bullets.GetComponent <AttackArea>().aligment = aligment.enemy; Bullets.GetComponent <AttackArea>().DestroyCheck = character.DamageObjDestroy; Bullets.GetComponent <AttackArea>().Damage = Damage; //判別用のタグをつける Bullets.tag = Tags.Magic; //WaitTimeの間、待って再度実行する yield return(new WaitForSeconds(WaitTime)); } SetCoroutineReset(); offShooting(); }
protected virtual void Start() { abnManager.StateSymbolMaterial = abnStateManager.AbnStateSymbol; abnManager.objtransform = transform; anim = GetComponent <Animator>(); agent = GetComponent <NavMeshAgent>(); PC = GameObject.FindGameObjectWithTag("Player"); PLController = PC.GetComponent <PlayerController>(); Sensor = PlayerSensor.GetComponent <PlayerSensor>(); }
public override void Initialise() { base.Initialise(); entityCollider = GetComponentInChildren <Collider>(); entityRigidbody = GetComponentInChildren <Rigidbody>(); collisionSensor = GetComponentInChildren <PlayerSensor>(); collisionSensor.onCollision += OnPlayerHit; collisionSensor.onNearMiss += OnPlayerNearMiss; collisionSensor.onRingHit += OnPlayerRingHit; collisionSensor.onRelicHit += OnPlayerRelicHit; collisionSensor.onPlayerCollect += OnPlayerCollect; }
private IEnumerator ShotAction(GameObject target) { NowCoroutine = ShotAction(target); Sensor = PlayerSensor.GetComponent <PlayerSensor>(); //targetが感知範囲から出た時にShootingがのtreuときfalseにしてwhile抜ける while (Sensor.GetPL_Search() && GetShooting()) { // if (target.GetComponent<Character>().HP <= 0) //{ break; } if (!shootStop) { shootStop = true; //弾を生成する GameObject Bullets = Instantiate(Bullet, transform.position, Quaternion.identity); //弾に初速を与える Bullets.GetComponent <Rigidbody>().AddForce(transform.forward * ShotSpeed, ForceMode.Impulse); Bullets.AddComponent <AttackArea>(); Bullets.GetComponent <AttackArea>().aligment = aligment.enemy; Bullets.GetComponent <AttackArea>().DestroyCheck = character.DamageObjDestroy; Bullets.GetComponent <AttackArea>().Damage = Damage.GetValue(); //判別用のタグをつける Bullets.tag = Tags.Magic; SEManager.SetSE(MagicSystemManager.instance.SEManager.mizugorowaShot); } //WaitTimeの間、待って再度実行する //yield return new WaitForSeconds(WaitTime); while (CoolTime <= WaitTime.GetValue()) { yield return(null); CoolTime += Time.deltaTime; } shootStop = false; CoolTime = 0; } SetCoroutineReset(); offShooting(); }
private async Task GenerateAt(int x, int z) { GameObject floor = Instantiate(floorTemplate, transform); loadedTiles.Add(x + "," + z, floor); floor.name = "Tile" + x + "_" + z; PlayerSensor playerSensor = floor.GetComponentInChildren <PlayerSensor>(); playerSensor.xPos = x; playerSensor.zPos = z; float floorWidth = floor.transform.localScale.x; float floorDepth = floor.transform.localScale.z; floor.transform.position = new Vector3(x * floorWidth, transform.position.y, z * floorDepth); await GenerateCubes(floor, x, z, floorWidth, floorDepth); await GenerateShadows(floor, x, z, floorWidth, floorDepth, Mathf.Abs(x) + Mathf.Abs(z)); await GenerateTrees(floor, x, z, floorWidth, floorDepth, x); await GenerateRocks(floor, x, z, floorWidth, floorDepth, -(x + z)); await GenerateLogs(floor, x, z, floorWidth, floorDepth, z); }
protected override void Start() { base.Start(); playerSensor = GetComponentInChildren <PlayerSensor>(); StartCoroutine(FireProjectile()); }
public element Weakele; //壁の弱点属性 // Use this for initialization void Start() { PLSenser = _PLSenser.GetComponent <PlayerSensor>(); _HP = HP.GetValue(); }
protected override void Start() { base.Start(); playerSensor = GetComponentInChildren <PlayerSensor>(); }
override protected void Start() { base.Start(); playerSensor = GetComponentInParent <PlayerSensor>(); }