//tips
//キャラクター同期対応継続
Foxの動作確認を行う。デバフでの相手への暗闇付与がうまく動作しなかったのでスクリプト確認。
if (envPlaymove5photon.foxdarkflag)
{
Debuffcheck2();
Debug.Log("DebuffcheckSuccess2");
envPlaymove5photon.Foxdarkflag();
}
void Debuffcheck2()の中身がmooseのものになっていたためfoxの内容に変更。記載ずれが生じているかもしれない。注意しておく。下記に変更。
void Debuffcheck2()
{
Debug.Log("Debuffcheck2");
UIeffectdarker UIeffectdarker = GameObject.FindWithTag("DarkPanel").GetComponent<UIeffectdarker>();
UIeffectdarker.UIDarkOn();
無事に暗闇効果も付与できた。
Foxのwolf役の際のprefabdummyのhpバー数値がなぜか変化してしまう。移動の際の矢印キー操作が原因だったようなのでSliderのinteractableのチェックを外した。これによりHPを固定にすることができた。
Mooseの確認に移る。photonCountスクリプトにmooseの生成の記述をしていなかったのでそちらを加える。
Particle System wolfのparticleの方向がおかしかったのでQuaternion roteで指定。
var vp = new Vector3(33, -1, 121);
Quaternion rote = new Quaternion(-90.0f, 0.0f, 0.0f, 1.0f);
PhotonNetwork.Instantiate("Particle System wolf", vp, rote);
なぜかこの処理でも角度が変わらなかったのでスクリプトをprefabにアタッチしてみる。
新たにparticlerotateスクリプトを作成し、prefabにアタッチ。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ParticleRotate : MonoBehaviour
{
void Start()
{
Vector3 lookpos = this.transform.position;
lookpos.y = transform.position.y+100;
transform.LookAt(lookpos);
}
}
これによりprefabはスポーン位置の上を向くようになった。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class ParticlePlayeP : MonoBehaviourPunCallbacks
{
ParticleSystem particle;
void Start()
{
particle = GetComponent<ParticleSystem>();
particle.Stop();
}
public void ParticleOn()
{
photonView.RPC(nameof(DoParticleOn), RpcTarget.All);
}
[PunRPC]
void DoParticleOn()
{
particle.Play();
StartCoroutine("PartcleStop");
}
private IEnumerator PartcleStop()
{
yield return new WaitForSeconds(2);
particle.Stop();
}
}
これで各シーンで効果が発動するようになった。
カメラの参照でエラーが発生しているのでそちらも確認していく。
BaseCamera.SetActive(!BaseCamera.activeSelf);の部分でエラーが生じていたが、シーンのmaincameraのタグを外していたのが問題であった。
Wolf役の方を確認していく。
rabbitspeedup = 0f;にしてもスピードが遅くなるだけで動けてしまう。
代わりにRigidbodyのフリーズ機能を使用した。
rb.constraints = RigidbodyConstraints.FreezePosition;
rb.constraints = RigidbodyConstraints.None;
rb.constraints = RigidbodyConstraints.FreezeRotation;
無事にその場から動けなくなった。
Deerの最終チェックを行う。deer同士で行うと感知のminimapカメラが必ずしも自分を中心にしないという問題が発生した。確かに同じキャラの場合には対処できていなかったので、photonviewismineの選別をどこかで挟む必要がありそう。