コード例 #1
0
            public void Update()
            {
                if (!body || !body.transform)
                {
                    return;
                }

                if (NetworkServer.active)
                {
                    if (target)
                    {
                        HealthComponent healthComponent = target.healthComponent;
                        if (!target.HasBuff(buffDef) || !healthComponent || !healthComponent.alive)
                        {
                            ClearTarget();
                        }
                    }
                }

                stopwatch += Time.deltaTime;
                waveY      = Mathf.Sin(stopwatch * Mathf.PI * waveFrequency + waveOffset * Mathf.PI * 2) * waveAmplitude;

                if (target)
                {
                    leash.leashOrigin = target.corePosition + offset * target.radius + Vector3.up * waveY;
                    rotateToDirection.targetRotation = Util.QuaternionSafeLookRotation(target.corePosition - transform.position);
                }
                else
                {
                    leash.leashOrigin = body.corePosition + offset * body.radius + Vector3.up * waveY;
                    rotateToDirection.targetRotation = Quaternion.LookRotation(body.inputBank.aimDirection);
                }

                ItemDisplay  itemDisplay  = follower.GetComponent <ItemDisplay>();
                ModelLocator modelLocator = body.modelLocator;

                if (modelLocator)
                {
                    Transform modelTransform = modelLocator.modelTransform;
                    if (modelTransform)
                    {
                        CharacterModel characterModel = modelTransform.GetComponent <CharacterModel>();
                        if (characterModel)
                        {
                            itemDisplay.SetVisibilityLevel(characterModel.visibility);
                            foreach (CharacterModel.RendererInfo rendererInfo in itemDisplay.rendererInfos)
                            {
                                Renderer renderer = rendererInfo.renderer;
                                renderer.GetPropertyBlock(materialPropertyBlock);
                                materialPropertyBlock.SetFloat("_Fade", target ? 1f : 1f / body.inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_Spotter));
                                renderer.SetPropertyBlock(materialPropertyBlock);
                            }
                        }
                    }
                }
            }