Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        SetState("IgnoreProjectile");
        //    gameObject.GetComponent<SphereCollider>().radius = searchRange;
        //    gameObject.GetComponent<SphereCollider>().isTrigger = true;

        playerCharController = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterController>();
        _s_playerCollider    = new _slime_SphereCollider(playerCharController.transform.rotation * playerCharController.center + playerCharController.transform.position, playerCharController.radius);
        m_collider           = gameObject.GetComponents <SphereCollider>();

        int i = 0;

        m_s_collider = new _slime_SphereCollider[m_collider.Length];
        foreach (SphereCollider c in m_collider)
        {
            m_s_collider[i] = new _slime_SphereCollider(c.transform.rotation * c.center + c.transform.position, c.radius);
            c.enabled       = false;
            i++;
        }

        isHitPlayer = false;
    }
 public bool Intersects(_slime_SphereCollider coll)
 {
     return((coll.centerPos - centerPos).magnitude <= coll.radius + radius);
 }