Exemplo n.º 1
0
 private void Start()
 {
     player = (MinifigController)this.GetComponent("MinifigController");
     //HealtSystem of Player
     //HealthSystemI healthSystem = new HealthSystemI(100);
     //currentHealth = 100;
 }
Exemplo n.º 2
0
    void OnTriggerEnter(Collider other)
    {
        print("Respawn");
        MinifigController otherController = (MinifigController)other.gameObject.GetComponent("MinifigController");

        otherController.TeleportTo(RespawnPointWSAD.transform.position);
    }
Exemplo n.º 3
0
        void Awake()
        {
            m_MinifigController = GetComponent <MinifigController>();

            EventManager.AddListener <GameStateChangeEvent>(OnGameStateChangeEvent);
            EventManager.AddListener <OptionsMenuEvent>(OnOptionsMenuEvent);
        }
Exemplo n.º 4
0
        void Awake()
        {
            m_MinifigController = GetComponent <MinifigController>();
            m_GameFlowManager   = FindObjectOfType <GameFlowManager>();

            EventManager.AddListener <GameOverEvent>(OnGameOver);
            EventManager.AddListener <OptionsMenuEvent>(OnOptionsMenu);
        }
Exemplo n.º 5
0
        // Start is called before the first frame update
        void Start()
        {
            //_navAgent = GetComponent<NavMeshAgent>();
            _grabber = GetComponent <GrabKartPart>();
            minifig  = GetComponent <MinifigController>();

            //homePlate = GetComponent<GameObject>();
            _state = State.FIND;
        }
Exemplo n.º 6
0
        void Start()
        {
            var controller = GetComponent <CharacterController>();

            m_HalfHeight = controller.height * 0.5f;
            m_Radius     = controller.radius;
            m_Center     = Vector3.up * m_HalfHeight;

            m_MinifigController = GetComponent <MinifigController>();
        }
Exemplo n.º 7
0
    public void enableAi()
    {
        isAi = true;

        MinifigController cont      = GetComponent <MinifigController>();
        NavMeshScript     navScript = GetComponent <NavMeshScript>();
        NavMeshAgent      navAgent  = GetComponent <NavMeshAgent>();

        cont.enabled      = false;
        navScript.enabled = true;
        navAgent.enabled  = true;
    }
Exemplo n.º 8
0
 private void Start()
 {
     player = (MinifigController)this.GetComponent("MinifigController");
 }
Exemplo n.º 9
0
        protected override void Start()
        {
            base.Start();

            if (IsPlacedOnBrick())
            {
                // Add particle system.
                if (m_Effect)
                {
                    m_ParticleSystem = Instantiate(m_Effect, transform);
                    m_ParticleSystem.Stop();

                    var emissionColliderWeights = new List <int>();

                    // Scale particle emission with volume of scoped bricks.
                    var scopeVolume = 0.0f;
                    foreach (var brick in m_ScopedBricks)
                    {
                        foreach (var part in brick.parts)
                        {
                            foreach (var collider in part.colliders)
                            {
                                m_EmissionColliders.Add(collider);
                                var colliderType = collider.GetType();
                                if (colliderType == typeof(BoxCollider))
                                {
                                    var boxCollider = (BoxCollider)collider;
                                    var volume      = boxCollider.size.x * boxCollider.size.y * boxCollider.size.z;
                                    var weight      = Mathf.Max(1, Mathf.RoundToInt(volume));
                                    emissionColliderWeights.Add(weight);
                                    m_EmissionColliderWeightSum += weight;
                                    scopeVolume += volume;
                                }
                                else if (colliderType == typeof(SphereCollider))
                                {
                                    var sphereCollider = (SphereCollider)collider;
                                    var volume         = 4.0f / 3.0f * Mathf.PI * sphereCollider.radius * sphereCollider.radius * sphereCollider.radius;
                                    var weight         = Mathf.Max(1, Mathf.RoundToInt(volume));
                                    emissionColliderWeights.Add(weight);
                                    m_EmissionColliderWeightSum += weight;
                                    scopeVolume += volume;
                                }
                            }
                        }
                    }

                    m_EmissionRate = Mathf.Clamp(k_ParticleEmissionPerModule * scopeVolume / LEGOModuleVolume, k_MinParticleEmission, k_MaxParticleEmission);

                    // Compute an approximated distribution function for weighted random selection of emission colliders.
                    m_EmissionColliderDistribution = new int[m_EmissionColliderWeightSum];

                    var index = 0;
                    for (var i = 0; i < emissionColliderWeights.Count; ++i)
                    {
                        var colliderWeight = emissionColliderWeights[i];
                        for (var j = 0; j < colliderWeight; ++j)
                        {
                            m_EmissionColliderDistribution[index] = i;
                            index++;
                        }
                    }
                }

                // Add SensoryCollider to all brick colliders.
                foreach (var brick in m_ScopedBricks)
                {
                    foreach (var part in brick.parts)
                    {
                        foreach (var collider in part.colliders)
                        {
                            var hazardCollider = LEGOBehaviourCollider.Add <SensoryCollider>(collider, m_ScopedBricks, 0.64f, LayerMask.NameToLayer("Hazard"));
                            SetupSensoryCollider(hazardCollider);
                        }
                    }
                }

                // Find a reference to the player's minifig controller.
                var player = GameObject.FindGameObjectWithTag("Player");
                if (player)
                {
                    m_MinifigController = player.GetComponent <MinifigController>();
                }
            }
        }