示例#1
0
 private void ParseActivationZone()
 {
     activationZone = GetComponentInChildren <ActivationZone>() as ActivationZone;
     if (activationZone != null)
     {
         hasActivationZone = true;
         print("activation zone found");
         activationPosition = activationZone.transform.position;
         print(activationPosition.ToString());
         activationRadius = activationZone.transform.lossyScale.x / 2f;
         print(activationRadius.ToString());
         Destroy(activationZone.gameObject);
     }
 }
示例#2
0
    public void UpdateViewCollision(bool viewCollision)
    {
        if (perso.collset.Value != null)
        {
            CollSet c = perso.collset.Value;
            if (collSetObjects == null)
            {
                collSetObjects = new Dictionary <CollideType, GameObject[]>();
                foreach (KeyValuePair <CollideType, Reference <ZdxList> > entry in c.zdxList)
                {
                    if (entry.Value.Value != null)
                    {
                        ZdxList zdx = entry.Value.Value;
                        collSetObjects[entry.Key] = new GameObject[zdx.num_objects];
                        if (zdx.num_objects > 0 && zdx.objects.Value != null)
                        {
                            for (int i = 0; i < zdx.objects.Value.objects.Length; i++)
                            {
                                GeometricObject geo = zdx.objects.Value.objects[i].Value;
                                if (geo == null)
                                {
                                    continue;
                                }
                                collSetObjects[entry.Key][i] = geo.GetGameObject(GeometricObject.Type.Collide, entry.Key);
                                collSetObjects[entry.Key][i].transform.SetParent(transform);
                                collSetObjects[entry.Key][i].transform.localPosition = Vector3.zero;
                                collSetObjects[entry.Key][i].transform.localRotation = Quaternion.identity;
                                collSetObjects[entry.Key][i].transform.localScale    = Vector3.one;

                                /*if(viewCollision &&
                                 * if (viewCollision && c.GetPrivilegedActionZoneStatus(entry.Key, i) == CollSet.PrivilegedActivationStatus.ForceActive) {
                                 *      col.SetVisualsActive(true);
                                 * } else {
                                 *      col.SetVisualsActive(false);
                                 * }*/
                            }
                        }
                    }
                }
            }
            foreach (KeyValuePair <CollideType, GameObject[]> entry in collSetObjects)
            {
                if (entry.Value != null && entry.Value.Length > 0)
                {
                    foreach (GameObject gao in entry.Value)
                    {
                        if (gao != null)
                        {
                            gao.SetActive(false);
                        }
                    }
                }
            }
            if (viewCollision)
            {
                foreach (KeyValuePair <CollideType, Reference <ActivationList> > entry in c.activationList)
                {
                    if (!collSetObjects.ContainsKey(entry.Key))
                    {
                        continue;
                    }
                    if (entry.Value.Value != null && entry.Value.Value.num_objects > 0 && entry.Value.Value.objects.Value != null)
                    {
                        ActivationZoneArray azr = entry.Value.Value.objects.Value;
                        if (azr.elements.Length == 0)
                        {
                            continue;
                        }
                        for (int i = 0; i < azr.elements.Length; i++)
                        {
                            if (azr.elements[i].state.Value == state)
                            {
                                ActivationZone zone = azr.elements[i].activationList.Value;
                                if (zone != null && zone.num_objects > 0 && zone.objects.Value != null)
                                {
                                    foreach (ushort act in zone.objects.Value.objects)
                                    {
                                        if (collSetObjects[entry.Key].Length > act &&
                                            collSetObjects[entry.Key][act] != null)
                                        {
                                            collSetObjects[entry.Key][act].SetActive(true);
                                        }
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
    }