// ------------------------------------------------------------------------------- // Override Function public override void InitializeAgent() { academy = FindObjectOfType <DefenderAcademy>(); arena = m_DefenderArena; rb = transform.GetComponent <Rigidbody>(); rayPer = GetComponent <RayPerception3D>(); isReload = false; weapon = gameObject.GetComponent <WeaponController>(); weapon.Init(); shield = m_ShieldObject.GetComponent <ShieldAnimation>(); shield.Init(); }
// --------------------------------------------------------------------------------------------------- // Unity Function private void Start() { academy = FindObjectOfType <DefenderAcademy>(); MaxScore = (int)academy.resetParameters["MaxScore"]; AgentATransform = new TransformKeeping(AgentA.transform); AgentBTransform = new TransformKeeping(AgentB.transform); focusTeam = RandomTeamOn ? focusTeam.RandomTeam() : TeamType.A; // Score Notification scoreA.Subscribe ( _score => { m_ScoreAText.text = _score.ToString(); if (isPlaying) { CheckScore(); } } ).AddTo(this); scoreB.Subscribe ( _score => { m_ScoreBText.text = _score.ToString(); if (isPlaying) { CheckScore(); } } ).AddTo(this); // Add time when Playing Observable.EveryUpdate().Where(_ => isPlaying).Subscribe ( _ => time += Time.deltaTime ).AddTo(this); // Game has Begin isPlaying = true; }