Пример #1
0
    private void UpdateMask(TwoColLine colLine, Vector2 point, ref Vector2 mask)
    {
        List <TwoColManager.Col> other = colLine.ColManager.CheckCol(colLine);

        mask = Vector2.zero;

        foreach (TwoColManager.Col e in other)
        {
            if (e.col.HasType(TwoCol.ColType.COMBAT_DEF))
            {
                BatHero hero = e.col.GetComponent <BatHero>();
                if (hero)
                {
                    hero.Die();
                    die = true;
                    if (ac)
                    {
                        AudioSource.PlayClipAtPoint(ac, transform.position);
                    }
                    return;
                }
            }

            if (e.col.HasType(TwoCol.ColType.PHYSICS_DEF) && e.move.magnitude > mask.magnitude)
            {
                mask = e.move;
            }
        }
    }
Пример #2
0
    // Use this for initialization
    void Awake()
    {
        tColLine = GetComponent <TwoColLine> ();
        tCommon  = GetComponent <TwoCommon> ();

        tColPhys = GetComponent <TwoColPhysics> ();
        pGrav    = GetComponent <PlatGravity> ();
    }
Пример #3
0
    public override Vector2 CheckColLine(TwoColLine other)
    {
        if (!CheckColBounds(other))
        {
            return(Vector2.zero);
        }

        return(CheckColLineParam(other.P1, other.P2));
    }
Пример #4
0
 void Awake()
 {
     pCommon  = GetComponent <TwoCommon> ();
     tColLine = GetComponent <TwoColLine> ();
 }
Пример #5
0
 public override Vector2 CheckColLine(TwoColLine other)
 {
     return(other.CheckColCircle(this));
 }
Пример #6
0
 public virtual Vector2 CheckColLine(TwoColLine other)
 {
     return(Vector2.zero);
 }
Пример #7
0
    public void OnSceneGUI()
    {
        TwoCol myTarget = (TwoCol)target;

        if (myTarget.GetTypes.Length == 0)
        {
            return;
        }

        if (myTarget.GetTypes.Length > 1)
        {
            Handles.color = UnityEngine.Color.magenta;
        }
        if (myTarget.HasType(TwoCol.ColType.COMBAT_DEF))
        {
            Handles.color = UnityEngine.Color.blue;
        }
        else if (myTarget.HasType(TwoCol.ColType.COMBAT_OFF))
        {
            Handles.color = UnityEngine.Color.red;
        }
        else if (myTarget.HasType(TwoCol.ColType.PHYSICS_DEF))
        {
            Handles.color = UnityEngine.Color.green;
        }
        else if (myTarget.HasType(TwoCol.ColType.PHYSICS_OFF))
        {
            Handles.color = UnityEngine.Color.yellow;
        }
        else if (myTarget.HasType(TwoCol.ColType.T3_DEF))
        {
            Handles.color = UnityEngine.Color.cyan;
        }
        else
        {
            Handles.color = UnityEngine.Color.grey;
        }

        if (myTarget.GetType() == typeof(TwoColCircle))
        {
            TwoColCircle temp = (TwoColCircle)myTarget;

            Handles.DrawWireDisc(temp.Center, UnityEngine.Vector3.forward, temp.Rad);
        }
        else
        if (myTarget.GetType() == typeof(TwoColSquare))
        {
            TwoColSquare temp = (TwoColSquare)myTarget;

            Handles.DrawLine(new UnityEngine.Vector3(temp.BL.x, temp.BL.y, 0.0f), new UnityEngine.Vector3(temp.BL.x, temp.TR.y, 0.0f));
            Handles.DrawLine(new UnityEngine.Vector3(temp.BL.x, temp.BL.y, 0.0f), new UnityEngine.Vector3(temp.TR.x, temp.BL.y, 0.0f));
            Handles.DrawLine(new UnityEngine.Vector3(temp.TR.x, temp.TR.y, 0.0f), new UnityEngine.Vector3(temp.BL.x, temp.TR.y, 0.0f));
            Handles.DrawLine(new UnityEngine.Vector3(temp.TR.x, temp.TR.y, 0.0f), new UnityEngine.Vector3(temp.TR.x, temp.BL.y, 0.0f));
        }
        if (myTarget.GetType() == typeof(TwoColLine))
        {
            TwoColLine temp = (TwoColLine)myTarget;

            Handles.DrawLine(new UnityEngine.Vector3(temp.P1Draw.x, temp.P1Draw.y, 0.0f), new UnityEngine.Vector3(temp.P2Draw.x, temp.P2Draw.y, 0.0f));
        }
    }