Esempio n. 1
0
 private void OnDrawGizmos()
 {
     if (!EditorApplication.isPlaying)
     {
         pivot = transform.position;
     }
     Gizmos.color = Color.green;
     //Gizmos.DrawWireSphere(pivot, radius);
     //GizmosExtensions.DrawWireArc(pivot, radius, maxAngle, 36 ,Quaternion.Euler(-startAngle, 90, 90));
     GizmosExtensions2D.DrawWireCircle2D(pivot + new Vector3(radius * Mathf.Cos((startAngle - delay / duration * maxAngle) * Mathf.Deg2Rad), radius * Mathf.Sin((startAngle - delay / duration * maxAngle) * Mathf.Deg2Rad)), radius / 8, 20);
     //GizmosExtensions2D.DrawWireArc2D(pivot, radius, startAngle, startAngle + maxAngle, 36);
     GizmosExtensions2D.DrawWireArcArrow2D(pivot, radius, startAngle, startAngle + maxAngle, 36);
 }
Esempio n. 2
0
    private void OnDrawGizmos()
    {
        GizmosExtensions2D.DrawWireCircle2D(transform.position, radius);
        if ((target.transform.position - transform.position).magnitude < radius)
        {
            Gizmos.color = Color.red;
        }
        else
        {
            Gizmos.color = Color.white;
        }
        switch (attackType)
        {
        case AttackType.Target:
            float distance = (transform.position - target.transform.position).magnitude;
            distance = Mathf.Min(distance, radius);
            GizmosExtensions2D.DrawArrow2D(transform.position, transform.position + (target.transform.position - transform.position).normalized * distance);
            break;

        case AttackType.Direction:
            GizmosExtensions2D.DrawArrow2D(transform.position, transform.position + new Vector3(Mathf.Cos(angle * Mathf.Deg2Rad), Mathf.Sin(angle * Mathf.Deg2Rad)) * bulletSpeed);
            break;
        }
    }