示例#1
0
    void OnTriggerEnter(Collider other)
    {
        if (enabled)
        {
            SpawnField field = other.GetComponent <SpawnField>();

            if (field != null && other.CompareTag(spawnAreaTag))
            {
                Vector3    position = field.AlignPosition(transform.position);
                Quaternion rotation = field.AlignRotation(transform.up);

#pragma warning disable CS0219
//#pragma warning disable CS1692
                GameObject newObject = Instantiate(
                    objPrefab.constValue,
                    position,
                    rotation,
                    null
                    ) as GameObject;
#pragma warning restore

                MortalityHandler.Kill(gameObject);
            }
        }
    }
示例#2
0
 void Update()
 {
     if (Time.time > startTime + timeOutDelay.constValue)
     {
         MortalityHandler.Kill(gameObject);
     }
 }
示例#3
0
    private void OnTriggerEnter(Collider other)
    {
        MortalityHandler.Kill(gameObject);

        countVariable.value--;

        if (countVariable.value == 0)
        {
            lastOneEvent.Invoke();
        }
    }
示例#4
0
    private void Update()
    {
        if (Time.time > startTime + delay.constValue)
        {
            if (!keepRetrying.constValue)
            {
                this.enabled = false;
            }

            MortalityHandler.Kill(gameObject);
        }
    }
示例#5
0
    public void RefreshStatus()
    {
        int  remainingCount = pickupCount.constValue;
        bool opened         = remainingCount == 0;

        // Toggle which door is opened
        openedObject.SetActive(opened);
        closedObject.SetActive(!opened);

        // Manage trails
        if (trails == null)
        {
            trails = new List <GameObject>();
        }

        while (remainingCount != trails.Count)
        {
            if (remainingCount < trails.Count)
            {
                // We have too many
                GameObject marked = trails[0];
                trails.RemoveAt(0);

                MortalityHandler.Kill(marked);
            }
            else
            {
                GameObject newTrail = Instantiate(
                    trailPrafab.constValue,
                    transform.position,
                    transform.rotation,
                    transform
                    ) as GameObject;

                trails.Add(newTrail);
            }
        }
    }