Пример #1
0
    public static PVETriggerCollider Create(SCreateTriggerBehaviour b)
    {
        if (!Level.currentRoot)
        {
            return(null);
        }
        if (!triggerParent)
        {
            triggerParent      = Level.currentRoot.AddNewChild();
            triggerParent.name = "trigger_parent";
        }

        Transform t = triggerParent.AddNewChild();

        t.name = Util.Format("trigger_{0}", b.triggerId.ToString("D2"));
        var c = t.GetComponentDefault <PVETriggerCollider>();
        //必须要返回的示例,避免修改内存中的备份
        SCreateTriggerBehaviour b_new = new SCreateTriggerBehaviour(b.behaviour.DeepClone(), null);
        Vector4_ range = b_new.range;

        if (b_new.isRandom)
        {
            range.x = (new PseudoRandom()).Range(b_new.range.x, b_new.range.y);
            range.y = 0;
        }
        c.InitComponent(b_new, range);
        c.RefreshScenePlayers();
        return(c);
    }
Пример #2
0
 public void ReActive(SCreateTriggerBehaviour b, Vector4 range)
 {
     behaviour = b;
     //force set state to 1
     if (state != EnumTriggerState.Open)
     {
         behaviour.state = 1;
     }
     SetRange(range);
 }
Пример #3
0
 private void InitComponent(SCreateTriggerBehaviour b, Vector4_ range)
 {
     behaviour = b;
     CreateEffectNode();
     isTrigger = true;
     layer     = 0;
     AddLayerToTarget(Creature.COLLIDER_LAYER_HIT);
     SetRange(range);
     PlayParticle();
 }