public void SetBlowFly(Vector3 attackerPos, Vector3 selfPos, Vector3 attackerDir)
    {
        Vector3 dir = Vector3.zero;

        switch (blowData.m_Direction)
        {
        case DirectionEnum.Forward:
            dir = attackerDir;
            break;

        case DirectionEnum.Backward:
            dir = attackerDir * (-1);
            break;

        case DirectionEnum.Close:
            dir   = (attackerPos - selfPos);
            dir.y = 0;
            dir   = dir.normalized;
            break;

        case DirectionEnum.Leave:
            dir   = (selfPos - attackerPos);
            dir.y = 0;
            dir   = dir.normalized;
            break;
        }

        blowDir.FromVector(dir);
    }
Ejemplo n.º 2
0
    SyncVector3 Offset_Circle_Circle(Area area)
    {
        float distance = Vector3.Distance(position, area.position);

        float r = radius + area.radius;

        //Debug.Log("distance " + distance + " r " + r + " ");

        if (distance < r)
        {
            SyncVector3 offset = new SyncVector3();
            offset.FromVector((area.position - position).normalized * (r - distance));

            return(offset);
        }
        else
        {
            return(new SyncVector3());
        }
    }