Exemple #1
0
        public override void OnCreated(IThreading threading)
        {
            _helper        = MonitorHelper.Instance;
            _zombieManager = ZombieManager.instance;
            _initialized   = false;
            _terminated    = false;

            base.OnCreated(threading);
        }
        public void SetRenderParameters(Vector3 position, Quaternion rotation, Vector3 velocity, Color color, int state, bool underground)
        {
            ZombieManager instance     = Singleton <ZombieManager> .instance;
            ZombieManager expr_0C_cp_0 = instance;

            expr_0C_cp_0.m_drawCallData.m_defaultCalls = expr_0C_cp_0.m_drawCallData.m_defaultCalls + 1;
            Transform transform = base.transform;

            transform.position = position;
            transform.rotation = rotation;
            float magnitude = velocity.magnitude;

            this.m_animator.SetFloat(instance.ID_Speed, magnitude);
            this.m_animator.SetInteger(instance.ID_State, state);
            if (this.m_instanceChanged)
            {
                this.m_instanceChanged = false;
                switch (state)
                {
                case 0:
                    if (magnitude > 0.1f)
                    {
                        this.m_animator.Play("walk 0", -1, UnityEngine.Random.value);
                    }
                    else
                    {
                        this.m_animator.Play("idle", -1, UnityEngine.Random.value);
                    }
                    break;

                case 1:
                    if (magnitude > 0.1f)
                    {
                        this.m_animator.Play("walk 0", -1, UnityEngine.Random.value);
                    }
                    else
                    {
                        this.m_animator.Play("panic", -1, UnityEngine.Random.value);
                    }
                    break;

                case 2:
                    this.m_animator.Play("sitting idle", -1, UnityEngine.Random.value);
                    break;

                case 3:
                    if (magnitude > 0.1f)
                    {
                        this.m_animator.Play("bike-ride", -1, UnityEngine.Random.value);
                    }
                    else
                    {
                        this.m_animator.Play("bike-idle", -1, UnityEngine.Random.value);
                    }
                    break;

                case 4:
                    if (magnitude > 0.1f)
                    {
                        this.m_animator.Play("walk 0", -1, UnityEngine.Random.value);
                    }
                    else
                    {
                        this.m_animator.Play("idle2", -1, UnityEngine.Random.value);
                    }
                    break;
                }
            }
            if (magnitude < 0.1f)
            {
                this.m_animator.speed = (1f - magnitude * 9f) * Singleton <SimulationManager> .instance.m_simulationTimeSpeed;
            }
            else
            {
                this.m_animator.speed = magnitude * Singleton <SimulationManager> .instance.m_simulationTimeSpeed;
            }

            if (this.m_renderer != null)
            {
                if (this.m_material != null)
                {
                    this.m_renderer.sharedMaterial = this.m_material;
                }
                this.m_renderer.gameObject.layer = Singleton <CitizenManager> .instance.m_citizenLayer;
            }
            else if (this.m_material != null)
            {
                this.m_material.color = color;
            }
        }