コード例 #1
0
        /// <summary>
        ///     Finds an appropriate target
        /// </summary>
        private void LookForTarget()
        {
            PlayerDriver player = PlayerDriver.Party.GetLeader();

            if (player != null && this.CanSee(player.gameObject))
            {
                this.targetPlayer = player;
            }
        }
コード例 #2
0
        /// <summary>
        ///     Started as a coroutine to update the target
        /// </summary>
        /// <returns>An iterator</returns>
        private IEnumerator UpdateTarget()
        {
            do
            {
                if (this.targetPlayer == null)
                {
                    if (Random.value < 0.2f)
                    {
                        this.spriteManager.FlipToDirection(!this.spriteManager.IsFacingRight);
                    }

                    this.LookForTarget();
                }
                else if (!this.CanSee(this.targetPlayer.gameObject))
                {
                    this.targetPlayer = null;
                }

                yield return(new WaitForSeconds(TargetUpdateDelay));
            }while (!this.defeated);
        }
コード例 #3
0
 /// <summary>
 ///     Called by Unity to initialize the <seealso cref="RecruitablePlayer"/> whether it is active or not
 /// </summary>
 private void Awake()
 {
     this.playerDriver = this.GetComponent <PlayerDriver>();
 }